上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 38 下一页
摘要: 题目: 解答: 1 class Solution { 2 private: 3 vector<int> candidates; 4 vector<vector<int>> res; 5 vector<int> path; 6 public: 7 void DFS(int start, int tar 阅读全文
posted @ 2020-05-05 14:58 梦醒潇湘 阅读(150) 评论(0) 推荐(0)
摘要: 题目: 解答: https://leetcode-cn.com/problems/combination-sum/solution/hui-su-suan-fa-jian-zhi-python-dai-ma-java-dai-m-2/ 1 class Solution { 2 private: 3 阅读全文
posted @ 2020-05-05 14:55 梦醒潇湘 阅读(165) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class Solution { 2 public: 3 int threeSumClosest(vector<int>& nums, int target) 4 { 5 sort(nums.begin(),nums.end()); 6 7 int ans = nums[0] + 阅读全文
posted @ 2020-05-05 14:51 梦醒潇湘 阅读(142) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class Solution { 2 public: 3 int maxArea(vector<int>& height) 4 { 5 int i = 0; 6 int j = height.size() - 1; 7 int res = 0; 8 9 while(i < j) 阅读全文
posted @ 2020-05-05 14:42 梦醒潇湘 阅读(147) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class Solution { 2 public: 3 int missingNumber(vector<int>& nums) 4 { 5 int i = 0; 6 int j = nums.size() - 1; 7 8 while(i <= j) 9 { 10 int m 阅读全文
posted @ 2020-05-05 14:34 梦醒潇湘 阅读(268) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class Solution { 2 public: 3 int search(vector<int>& nums, int target) 4 { 5 int left = left_bound(nums, target); 6 int right = right_bound( 阅读全文
posted @ 2020-05-05 14:28 梦醒潇湘 阅读(290) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class Solution { 2 public: 3 int minArray(vector<int>& nums) 4 { 5 int left = 0; 6 int right = nums.size() - 1; /* 左闭右闭区间,如果用右开区间则不方便判断右值 */ 阅读全文
posted @ 2020-05-05 14:24 梦醒潇湘 阅读(146) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class Solution { 2 public: 3 bool searchMatrix(vector<vector<int>>& matrix, int target) 4 { 5 int i = matrix.size() - 1; 6 int j = 0; 7 8 // 阅读全文
posted @ 2020-05-05 14:21 梦醒潇湘 阅读(237) 评论(0) 推荐(0)
摘要: 题目: 解答: 1 class Solution { 2 public: 3 int findString(vector<string>& words, string s) 4 { 5 int left = 0; 6 int right = words.size() - 1; 7 8 while ( 阅读全文
posted @ 2020-05-05 14:18 梦醒潇湘 阅读(195) 评论(0) 推荐(0)
摘要: 题目: 解答: 这个题目真是打了各种补丁啊。。。。 1 class Solution { 2 public: 3 int search(vector<int>& nums, int target) 4 { 5 int l = 0; 6 int r = nums.size() -1; 7 8 whil 阅读全文
posted @ 2020-05-05 14:08 梦醒潇湘 阅读(230) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 38 下一页