摘要:
1 // 统计个数,相同位置相同数字的个数 >A的个数 2 // 不同位置相同数字的个数 >B的个数 3 class Solution 4 { 5 public: 6 string getHint(string secret, string guess) 7 { 8 int n = secret.s 阅读全文
posted @ 2020-04-15 16:38
Jinxiaobo0509
阅读(118)
评论(0)
推荐(0)
摘要:
1 class Solution 2 { 3 public: 4 bool canWinNim(int n) 5 { 6 //如果不是4的倍数,必赢 7 //如果是4的倍数,必输 8 return n % 4 != 0; 9 } 10 }; 阅读全文
posted @ 2020-04-15 15:29
Jinxiaobo0509
阅读(87)
评论(0)
推荐(0)
摘要:
1 class Solution 2 { 3 vector<string> res; 4 void spilt(string s,char c,vector<string> &res) 5 { 6 istringstream iss(s); 7 string temp; 8 while(getlin 阅读全文
posted @ 2020-04-15 15:09
Jinxiaobo0509
阅读(117)
评论(0)
推荐(0)
摘要:
1 class Solution 2 { 3 int dx[8] = {1,1,0,-1,-1,-1,0,1}; 4 int dy[8] = {0,1,1,1,0,-1,-1,-1}; 5 public: 6 void gameOfLife(vector<vector<int>>& board) 7 阅读全文
posted @ 2020-04-15 14:40
Jinxiaobo0509
阅读(119)
评论(0)
推荐(0)
摘要:
1 /* 2 * Below is the interface for Iterator, which is already defined for you. 3 * **DO NOT** modify the interface for Iterator. 4 * 5 * class Iterat 阅读全文
posted @ 2020-04-15 13:57
Jinxiaobo0509
阅读(96)
评论(0)
推荐(0)
摘要:
1 class Solution 2 { 3 public: 4 void moveZeroes(vector<int>& nums) 5 { 6 int n = nums.size(); 7 int begin = 0; 8 for(int i = 0;i < n;i ++) 9 { 10 if( 阅读全文
posted @ 2020-04-15 12:44
Jinxiaobo0509
阅读(84)
评论(0)
推荐(0)
摘要:
1 class Solution 2 { 3 public: 4 int numSquares(int n) 5 { 6 queue<pair<int,int>> Q; 7 Q.push(make_pair(n,0)); 8 vector<bool> visit(n+1,false); 9 //层序 阅读全文
posted @ 2020-04-15 11:41
Jinxiaobo0509
阅读(138)
评论(0)
推荐(0)
摘要:
1 class Solution 2 { 3 public: 4 int hIndex(vector<int>& nums) 5 { 6 sort(nums.begin(),nums.end()); 7 int l = 0,r = nums.size(); 8 while(l < r) 9 { 10 阅读全文
posted @ 2020-04-15 10:35
Jinxiaobo0509
阅读(94)
评论(0)
推荐(0)
摘要:
1 //[3,0,1] + [0,1,2,3] = [0,0,1,1,2,3,3] ——> 求异或 2 class Solution 3 { 4 public: 5 int missingNumber(vector<int>& nums) 6 { 7 int n = nums.size(); 8 i 阅读全文
posted @ 2020-04-15 10:26
Jinxiaobo0509
阅读(139)
评论(0)
推荐(0)

浙公网安备 33010602011771号