上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 38 下一页
摘要: 1 class Solution 2 { 3 public: 4 uint32_t reverseBits(uint32_t n) 5 { 6 uint32_t res = 0; 7 for(int i = 0;i < 32;i ++) //得到从最低位到最高位的每一位数 8 { 9 res += 阅读全文
posted @ 2020-04-03 23:04 Jinxiaobo0509 阅读(88) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 void rotate(vector<int>& nums, int k) 5 { 6 int n = nums.size(); 7 k = k % n; 8 reverse(nums.begin(),nums.begin() + n 阅读全文
posted @ 2020-04-03 22:44 Jinxiaobo0509 阅读(88) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 vector<string> findRepeatedDnaSequences(string s) 5 { 6 int n = s.size(); 7 vector<string> res; 8 unordered_map<strin 阅读全文
posted @ 2020-04-03 22:33 Jinxiaobo0509 阅读(158) 评论(0) 推荐(0)
摘要: 1 bool compare(int a,int b)//int比较 2 { 3 string str1=to_string(a); 4 string str2=to_string(b); 5 return (str1+str2) > (str2+str1); 6 } 7 8 class Solut 阅读全文
posted @ 2020-04-03 22:22 Jinxiaobo0509 阅读(134) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 bool makesquare(vector<int>& nums) 5 { 6 if(nums.size()<4) return false; 7 int sum=0; 8 for(int i=0;i<nums.size();i++ 阅读全文
posted @ 2020-04-03 21:13 Jinxiaobo0509 阅读(174) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int trailingZeroes(int n) 5 { 6 int res = 0; 7 while(n >= 5) 8 { 9 res += n / 5; 10 n /= 5; 11 } 12 return res; 13 } 阅读全文
posted @ 2020-04-03 17:17 Jinxiaobo0509 阅读(112) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int titleToNumber(string s) 5 { 6 unordered_map<char,int> hash; 7 for(int i = 1;i <= 26;i ++) hash['A' + i - 1] = i; 阅读全文
posted @ 2020-04-03 16:44 Jinxiaobo0509 阅读(123) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int majorityElement(vector<int>& nums) 5 { 6 unordered_map<int,int> hash; 7 for(auto a : nums) hash[a]++; 8 for(auto 阅读全文
posted @ 2020-04-03 16:34 Jinxiaobo0509 阅读(106) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 string convertToTitle(int n) 5 { 6 unordered_map<int,char> hash; 7 for(int i = 1;i <= 26;i ++) hash[i] = 'A' + i - 1; 阅读全文
posted @ 2020-04-03 16:31 Jinxiaobo0509 阅读(150) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 vector<int> twoSum(vector<int>& numbers, int target) 5 { 6 int l = 0,r = numbers.size() - 1; 7 while(l < r) 8 { 9 if( 阅读全文
posted @ 2020-04-03 16:06 Jinxiaobo0509 阅读(122) 评论(0) 推荐(0)
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 38 下一页