摘要:
https://leetcode.com/problems/guess-number-higher-or-lower/ 阅读全文
摘要:
// https://discuss.leetcode.com/topic/50527/java-10ms-solution-no-priority-queue class Solution { public: vector> kSmallestPairs(vector& nums1, vector& nums2, int k) { sort(nums1.begin()... 阅读全文
摘要:
// https://discuss.leetcode.com/topic/50489/c-clean-and-short-solution class Solution { int base = 1337; int powMod(int a, int b) { a %= base; int result = 1; for (in... 阅读全文
摘要:
// refer to // https://leetcode.com/discuss/111582/java-simple-easy-understand-solution-with-explanation class Solution { public: int getSum(int a, int b) { //int tmp_sum = a ^ b; // a x... 阅读全文
摘要:
用了两种方法: 31 / 31 test cases passed. Accepted Runtime: 261 ms 开始用的下面这种方法,超时了: 阅读全文
摘要:
这道题目的循环里面的那个递推的式子很巧妙,能够帮助循环快速收敛。 阅读全文
摘要:
以下这个解法也是参考了一些讨论: https://leetcode.com/discuss/110235/c-solution-using-euclidean-algorithm 还有这个解释原理的,没有看懂:https://leetcode.com/discuss/110525/a-little- 阅读全文
摘要:
根据上一篇文章提到的参考文档: https://leetcode.com/discuss/109749/accepted-c-codes-with-explanation-and-references 我实现的解法,用了一个sum_max,不再另设res。 27 / 27 test cases pa 阅读全文
摘要:
今天的一道题目: https://leetcode.com/problems/max-sum-of-sub-matrix-no-larger-than-k/ 有难度。这一类题目很有代表性。 搜到这个网址有针对一维数组的求和的按照时间复杂度一步步优化的过程,讲的很不错: http://www.cnbl 阅读全文
摘要:
https://leetcode.com/problems/count-numbers-with-unique-digits/ class Solution { public: int countNumbersWithUniqueDigits(int n) { if (n < 1) { return 1; } ... 阅读全文