摘要: 1 class Solution 2 { 3 int temp; 4 public: 5 vector<vector<int>> floodFill(vector<vector<int>>& image, int sr, int sc, int newColor) 6 { 7 int m = ima 阅读全文
posted @ 2020-04-17 22:54 Jinxiaobo0509 阅读(196) 评论(0) 推荐(0)
摘要: 1 struct Node 2 { 3 Node* next[2] = {nullptr}; 4 }; 5 6 class Solution 7 { 8 public: 9 void insert(int num, Node* root) 10 { 11 for (int i = 30; i >= 阅读全文
posted @ 2020-04-17 21:39 Jinxiaobo0509 阅读(197) 评论(0) 推荐(0)
摘要: 1 //0-31位中 每一位0的个数与1的个数乘积之和 2 class Solution 3 { 4 public: 5 int totalHammingDistance(vector<int>& nums) 6 { 7 int res = 0; 8 for(int i = 0;i < 32;i + 阅读全文
posted @ 2020-04-17 17:05 Jinxiaobo0509 阅读(137) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int getSum(int a, int b) 5 { 6 if(!b) return a; 7 int sum = a ^ b,carry = (unsigned int)(a & b) << 1;//LeetCode编译器不支持 阅读全文
posted @ 2020-04-17 16:02 Jinxiaobo0509 阅读(89) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int findComplement(int num) 5 { 6 int res = 0,t = 0; 7 while(num) 8 { 9 res += !(num & 1) << t; 10 num >>= 1,t ++; 11 阅读全文
posted @ 2020-04-17 11:30 Jinxiaobo0509 阅读(98) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 unordered_set<int> hash = {2,3,5,7,11,13,17,19}; 5 int countPrimeSetBits(int L, int R) 6 { 7 int res = 0; 8 for(int i 阅读全文
posted @ 2020-04-17 10:59 Jinxiaobo0509 阅读(187) 评论(0) 推荐(0)
摘要: 1 //确定前三个数 2 class Solution 3 { 4 public: 5 vector<int> splitIntoFibonacci(string num) 6 { 7 vector<int> res; 8 int n = num.size(); 9 for(int i = 0;i 阅读全文
posted @ 2020-04-17 09:37 Jinxiaobo0509 阅读(155) 评论(0) 推荐(0)