原题链接:https://leetcode.cn/problems/bu-ke-pai-zhong-de-shun-zi-lcof/ 排序法 + 遍历: class Solution { public…
原题链接:https://leetcode.cn/problems/minimum-difference-between-highest-and-lowest-of-k-scores/ 排序+滑动窗口…
原题链接:https://leetcode.cn/problems/find-greatest-common-divisor-of-array/ class Solution { public: in…
原题链接:https://leetcode.cn/problems/number-of-common-factors/ 枚举到较小值: class Solution { public: int com…
原题链接:https://leetcode.cn/problems/count-primes/ 埃氏筛: class Solution { public: int countPrimes(int n)…
原题链接:https://leetcode.cn/problems/power-of-three/ 试除法: class Solution { public: bool isPowerOfThree(…
原题连接:https://leetcode.cn/problems/number-of-1-bits/ 逐位判断: class Solution { public: int hammingWeight…
原题链接:https://leetcode.cn/problems/valid-palindrome/ 筛选 + 判断法: class Solution { public: bool isPalind…
原题链接:https://leetcode.cn/problems/pascals-triangle/ class Solution { public: vector<vector<int…
原题链接:https://leetcode.cn/problems/sqrtx/ 二分查找法: int mySqrt(int x) { int low = 0; int high = x; int m…