![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 86
_luckylight
这个作者很懒,什么都没留下…
展开
-
leetcode第 46 场双周赛
题目Ahttps://leetcode-cn.com/problems/longest-nice-substring/因为 length≤100length \leq 100length≤100,我们直接就可以遍历子串然后更新答案。class Solution {public: bool Check(string s) { unordered_set<int> m; for (auto u : s) m.insert原创 2021-02-21 22:03:36 · 161 阅读 · 0 评论 -
LeetCode228场周赛解题报告
LeetCode228场周赛解题报告生成交替二进制字符串的最少操作数原题链接https://leetcode-cn.com/contest/weekly-contest-228/problems/minimum-changes-to-make-alternating-binary-string/解题思路直接进行暴力的将二进制字符串枚举,首个字符是0,还是1,枚举之后取最小值AC代码class Solution {public: int minOperations(string s)原创 2021-02-14 11:23:14 · 1132 阅读 · 0 评论 -
LeetCode第 227 场周赛题解
LeetCode第 227 场周赛题解检查数组是否经排序和轮转得到原题链接https://leetcode-cn.com/problems/check-if-array-is-sorted-and-rotated/解题思路直接进行测试就行,因为数组的数据范围很小,直接进行O(N2)O(N^2)O(N2)算法即可,注意数组下标的求余AC代码class Solution {public: bool Check(vector<int> a, vector<i原创 2021-02-08 17:03:08 · 140 阅读 · 0 评论 -
LeetCode第45场双周赛-解题报告
LeetCode第45场双周赛-解题报告A. 唯一元素的和原题链接https://leetcode-cn.com/problems/sum-of-unique-elements/解题思路因为数据范围比较小,可以直接模拟,如果出现一次就加上去。或者是直接map打表也可以AC代码暴力class Solution {public: bool Check(int x, vector<int> &nums){ int cnt = 0;原创 2021-02-07 18:15:39 · 164 阅读 · 0 评论