![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 64
Schnee_Cy
个人网站 www.schnee.pro
展开
-
Leetcode 刷题日记(Day1)— Array
之前有陆续刷过部分的 leetcode 题目,但为了春招做准备,决定重新按序刷一遍,也做好总结的工作,方便复习。参考的刷题顺序是 Leetcode 分类顺序表第二版 ,有一定的参考价值。LeetCode c++ 提速小技巧:关闭流同步,效果极好。static const auto speedup = []() { std::ios::sync_with_stdio(false...原创 2019-02-15 11:16:34 · 225 阅读 · 0 评论 -
LeetCode刷题日记(Day 2)— Array
LeetCode 299. Bulls and Cowsstring getHint(string secret, string guess) { int a = 0, b = 0, counter[11] = {0}; for(int i = 0; i < secret.size(); i++) counter[secret[i]-'0']++; ...原创 2019-02-15 15:45:46 · 154 阅读 · 0 评论 -
LeetCode刷题日记(Day 3)— Array
LeetCode 274. H-Indexint hIndex(vector<int>& citations) { sort(citations.begin(), citations.end()); reverse(citations.begin(), citations.end()); int n = citations.size(), ind...原创 2019-02-16 22:23:47 · 186 阅读 · 0 评论 -
LeetCode刷题日记(Day4)— String
LeetCode 28. Implement strStr()int strStr(string haystack, string needle) { const int max_num = 1024; int shift[max_num]; int n = haystack.size(), m = needle.size(); for(int i = 0;...原创 2019-02-17 23:40:37 · 179 阅读 · 0 评论 -
LeetCode刷题日记(Day5)— String
LeetCode 87. Scramble Stringbool isScramble(string s1, string s2) { if(s1 == s2) return true; int counter[26] = {0}, len = s1.size(); for(int i = 0; i < len; i++) { counter[...原创 2019-02-18 21:59:19 · 216 阅读 · 0 评论 -
LeetCode刷题日记(Day6)— Math
LeetCode 7.Reverse Integerint reverse(int x) { if(x == 0) return 0; bool belowZero = x < 0 ? true : false; long long num = x; string str = to_string(abs(num)); std::rever...原创 2019-02-19 23:26:37 · 221 阅读 · 0 评论 -
LeetCode刷题日记(Day7)— Math
LeetCode 204. Count Primesint countPrimes(int n) { vector<int> notPrime(n, 0); int count = 0; for(int i = 2; i < n; i++) { if(!notPrime[i]) { count++; ...原创 2019-02-20 21:04:00 · 190 阅读 · 0 评论