上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 38 下一页
摘要: 1 class Solution 2 { 3 public: 4 //欧拉路径 5 vector<string> findItinerary(vector<vector<string>> &tickets) 6 { 7 unordered_map<string, multiset<string>> 阅读全文
posted @ 2020-04-22 10:07 Jinxiaobo0509 阅读(412) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 //欧拉路径 5 vector<string> findItinerary(vector<vector<string>> &tickets) 6 { 7 unordered_map<string, multiset<string>> 阅读全文
posted @ 2020-04-22 10:06 Jinxiaobo0509 阅读(136) 评论(0) 推荐(0)
摘要: 1 //空节点的个数 = 非空节点个数 + 1 2 class Solution 3 { 4 vector<string> res; 5 void spilt(string s,char c) 6 { 7 istringstream iss(s); 8 string temp; 9 while(ge 阅读全文
posted @ 2020-04-21 22:21 Jinxiaobo0509 阅读(170) 评论(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-21 17:58 Jinxiaobo0509 阅读(113) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 bool isPowerOfFour(int num) 5 { 6 return (num > 0) && ((num & (-num)) == num) && (num % 3 == 1); 7 } 8 }; 阅读全文
posted @ 2020-04-21 17:44 Jinxiaobo0509 阅读(91) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 bool isPowerOfThree(int n) 5 { 6 return n > 0 && 1162261467 % n == 0; 7 } 8 }; 阅读全文
posted @ 2020-04-21 17:25 Jinxiaobo0509 阅读(78) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 void wiggleSort(vector<int>& nums) 5 { 6 int n = nums.size(); 7 sort(nums.begin(),nums.end()); 8 vector<int> temp; 9 阅读全文
posted @ 2020-04-21 16:48 Jinxiaobo0509 阅读(91) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int coinChange(vector<int>& coins, int amount) 5 { 6 vector<long long> dp(amount + 1,INT_MAX); 7 dp[0] = 0;//总金额为0元所需 阅读全文
posted @ 2020-04-21 14:42 Jinxiaobo0509 阅读(106) 评论(0) 推荐(0)
摘要: 1 class Solution 2 { 3 public: 4 int bulbSwitch(int n) 5 { 6 return sqrt(n); 7 } 8 }; 阅读全文
posted @ 2020-04-21 11:42 Jinxiaobo0509 阅读(120) 评论(0) 推荐(0)
摘要: 1、暴力求解 1 class Solution 2 { 3 public: 4 int maxProduct(vector<string>& words) 5 { 6 int n = words.size(); 7 int res = 0; 8 for(auto& a : words) sort(a 阅读全文
posted @ 2020-04-21 10:54 Jinxiaobo0509 阅读(144) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 38 下一页