上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 38 下一页
摘要: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; 阅读全文
posted @ 2020-04-02 18:03 Jinxiaobo0509 阅读(94) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 bool wordBreak(string s, vector<string>& wordDict) 5 { 6 vector<bool> dp(s.size()+1, false); 7 unordered_set<string> 阅读全文
posted @ 2020-04-02 17:54 Jinxiaobo0509 阅读(156) 评论(0) 推荐(0)
摘要: 1 //用bits数组统计nums中所有数转化成二进制后,每个位上1的个数 2 //将bits数组中能够整除3的值置0,不能整除3的值置1 3 //将bits转换成真的二进制数 4 class Solution 5 { 6 public: 7 int singleNumber(vector<int> 阅读全文
posted @ 2020-04-02 17:26 Jinxiaobo0509 阅读(165) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int singleNumber(vector<int>& nums) 5 { 6 int res = 0; 7 for(auto a : nums) res ^= a; 8 return res; 9 } 10 }; 阅读全文
posted @ 2020-04-02 17:06 Jinxiaobo0509 阅读(91) 评论(0) 推荐(0)
摘要: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; 阅读全文
posted @ 2020-04-02 16:10 Jinxiaobo0509 阅读(178) 评论(0) 推荐(0)
摘要: 1 /** 2 * // This is the interface that allows for creating nested lists. 3 * // You should not implement it, or speculate about its implementation 4 阅读全文
posted @ 2020-04-02 15:07 Jinxiaobo0509 阅读(140) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int canCompleteCircuit(vector<int>& gas, vector<int>& cost) 5 { 6 int n = gas.size(); 7 for(int i = 0;i < n;i ++) 8 { 阅读全文
posted @ 2020-04-02 13:42 Jinxiaobo0509 阅读(109) 评论(0) 推荐(0)
摘要: 1 /* 2 // Definition for a Node. 3 class Node { 4 public: 5 int val; 6 Node* next; 7 Node* random; 8 9 Node(int _val) { 10 val = _val; 11 next = NULL; 阅读全文
posted @ 2020-04-02 11:53 Jinxiaobo0509 阅读(139) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 vector<vector<string>>result; 5 vector<string>temp; 6 7 bool isPalindrome(string s) //是否为回文串 8 { 9 int i=0,j=s.size() 阅读全文
posted @ 2020-04-02 11:18 Jinxiaobo0509 阅读(129) 评论(0) 推荐(0)
摘要: 1 //1、从四条边出发,找到与"O"相连的,并把当前"O"置为"#" 2 //2、把"O"改为"X",把"#"改为"O" 3 class Solution 4 { 5 public: 6 void solve(vector<vector<char>>& board) 7 { 8 if (board 阅读全文
posted @ 2020-04-02 10:59 Jinxiaobo0509 阅读(161) 评论(0) 推荐(0)
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 38 下一页