上一页 1 2 3 4 5 6 7 8 ··· 17 下一页
摘要: class Solution { public: vector> findLadders(string beginWord, string endWord, vector& wordList) { unordered_set s(wordList.begin(), wordList.end()); vector> res; if (s.fi... 阅读全文
posted @ 2018-11-23 15:07 JTechRoad 阅读(165) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int ladderLength(string beginWord, string endWord, vector& wordList) { unordered_set s(wordList.begin(), wordList.end()); if (s.find(endWord) == s.end() |... 阅读全文
posted @ 2018-11-22 08:21 JTechRoad 阅读(105) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int rob(vector& nums) { if (nums.size() == 0) return 0; if (nums.size() == 1) return nums[0]; return max(helper(nums, 0, nums.size()-2), helpe... 阅读全文
posted @ 2018-11-22 07:40 JTechRoad 阅读(88) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int largestRectangleArea(vector& h) { stack s; int res = 0; h.push_back(0); for (int i = 0; i < h.size(); i++) { while (!s.emp... 阅读全文
posted @ 2018-11-22 06:40 JTechRoad 阅读(81) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int numRescueBoats(vector& people, int limit) { sort(people.begin(), people.end()); int res = 0; for (int i = 0, j = people.size()-1; i <= j; ) { ... 阅读全文
posted @ 2018-11-22 06:12 JTechRoad 阅读(93) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* s... 阅读全文
posted @ 2018-11-22 02:29 JTechRoad 阅读(119) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector> largeGroupPositions(string s) { vector> res; int start = 0, end = 0; for (int i = 1; i = 3) { vector t; ... 阅读全文
posted @ 2018-11-21 15:28 JTechRoad 阅读(87) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int numSquares(int n) { vector c; for (int i = 1; i*i q; q.push(0); int lv = 0; while (!q.empty()) { int qs = q.size(... 阅读全文
posted @ 2018-11-21 15:09 JTechRoad 阅读(74) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector> threeSum(vector& nums) { sort(nums.begin(), nums.end()); vector> res; if (nums.size() 0 && nums[i] == nums[i-1]) continue; i... 阅读全文
posted @ 2018-11-21 14:06 JTechRoad 阅读(95) 评论(0) 推荐(0) 编辑
摘要: /* // Definition for a Node. class Node { public: int val = NULL; Node* prev = NULL; Node* next = NULL; Node* child = NULL; Node() {} Node(int _val, Node* _prev, Node* _next... 阅读全文
posted @ 2018-11-20 14:54 JTechRoad 阅读(81) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 17 下一页