上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页
摘要: class Solution { public: vector<string> generateParenthesis(int n) { set<string> t; if (n == 0) t.insert(""); else { vector<string> pre = generatePare 阅读全文
posted @ 2017-02-10 22:32 王坤1993 阅读(142) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { if (!l1) return l2; if (!l2) return l1; if (l1->val < l2->val) { l1->ne 阅读全文
posted @ 2017-02-10 22:29 王坤1993 阅读(108) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: bool isValid(string s) { stack<char> parentheses; for (int i = 0; i < s.size(); ++i) { if (s[i] == '(' || s[i] == '[' || s[i] 阅读全文
posted @ 2017-02-10 22:27 王坤1993 阅读(130) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: ListNode* removeNthFromEnd(ListNode* head, int n) { if (!head->next) return NULL; ListNode *pre = head, *cur = head; for (int 阅读全文
posted @ 2017-02-10 22:25 王坤1993 阅读(99) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector<vector<int> > fourSum(vector<int> &nums, int target) { set<vector<int> > res; sort(nums.begin(), nums.end()); for (int 阅读全文
posted @ 2017-02-10 00:01 王坤1993 阅读(137) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector<string> letterCombinations(string digits) { vector<string> res; if (digits.empty()) return res; string dict[] = {"abc" 阅读全文
posted @ 2017-02-08 22:27 王坤1993 阅读(134) 评论(0) 推荐(0) 编辑
摘要:  阅读全文
posted @ 2017-02-08 00:07 王坤1993 阅读(131) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int threeSumClosest(vector<int>& nums, int target) { int closest = nums[0] + nums[1] + nums[2]; int diff = abs(closest - targ 阅读全文
posted @ 2017-02-08 00:03 王坤1993 阅读(100) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { set<vector<int>> res; sort(nums.begin(), nums.end()); for (int k = 0; k < n 阅读全文
posted @ 2017-02-07 00:00 王坤1993 阅读(153) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: string longestCommonPrefix(vector<string>& strs) { if (strs.empty()) return ""; for (int j = 0; j < strs[0].size(); ++j) { fo 阅读全文
posted @ 2017-02-06 00:06 王坤1993 阅读(119) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 20 下一页