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 · 286 阅读 · 0 评论 -
LeetCode刷题日记(Day 2)— Array
LeetCode 299. Bulls and Cows string 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 · 212 阅读 · 0 评论 -
LeetCode刷题日记(Day 3)— Array
LeetCode 274. H-Index int 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 · 273 阅读 · 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 · 268 阅读 · 0 评论 -
LeetCode刷题日记(Day5)— String
LeetCode 87. Scramble String bool 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 · 295 阅读 · 0 评论 -
LeetCode刷题日记(Day6)— Math
LeetCode 7.Reverse Integer int 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 · 342 阅读 · 0 评论 -
LeetCode刷题日记(Day7)— Math
LeetCode 204. Count Primes int 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 · 292 阅读 · 0 评论
分享