摘要:
解法一:Brute-force 1 int strStr(string haystack, string needle) 2 { 3 int m = haystack.size(); 4 int n = needle.size(); 5 if (!n) 6 ... 阅读全文
摘要:
1 void merge(vector& nums1, int m, vector& nums2, int n) 2 { 3 int i = m - 1; 4 int j = n - 1; 5 int k = m + n - 1; 6 while (i >=0 &&... 阅读全文
摘要:
1 vector summaryRanges(vector& nums) 2 { 3 int nums_len = nums.size(); 4 vector res; 5 if (nums_len == 0) 6 return res; 7 8 ... 阅读全文
摘要:
1 bool isPowerOfTwo(int n)2 {3 return n > 0 && !(n & (n - 1));4 } 阅读全文