上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 23 下一页
摘要: 39题组合总数也可以用这种模式 class Solution { public: vector<vector<int>> res; vector<vector<int>> permute(vector<int>& nums) { if(nums.size()==0) return res; vect 阅读全文
posted @ 2021-07-16 17:20 三一一一317 阅读(20) 评论(0) 推荐(0)
摘要: 解析参见: https://leetcode-cn.com/problems/trapping-rain-water/solution/jie-yu-shui-by-leetcode/327718/ class Solution { public: int trap(vector<int>& hei 阅读全文
posted @ 2021-07-16 16:04 三一一一317 阅读(33) 评论(0) 推荐(0)
摘要: 看到此题回想到用回溯法枚举可能的情况。 class Solution { public: vector<vector<int>> res; vector<vector<int>> combinationSum(vector<int>& candidates, int target) { if(can 阅读全文
posted @ 2021-07-16 15:07 三一一一317 阅读(21) 评论(0) 推荐(0)
摘要: class Solution { public: vector<int> searchRange(vector<int>& nums, int target) { vector<int> res; int left = lcoateleft(nums,0,nums.size()-1,target); 阅读全文
posted @ 2021-07-16 13:41 三一一一317 阅读(35) 评论(0) 推荐(0)
摘要: class Solution { public: int search(vector<int>& nums, int target) { int len = nums.size(); // if(len<2) // return 0; int left = 0; int right = len-1; 阅读全文
posted @ 2021-07-16 13:03 三一一一317 阅读(26) 评论(0) 推荐(0)
摘要: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 直接使用呢上面命令可能会报403错误 所以推荐使用国内镜像源 /bin/zsh -c "$(curl -fsSL htt 阅读全文
posted @ 2021-07-15 21:11 三一一一317 阅读(105) 评论(0) 推荐(0)
摘要: class Solution { public: void nextPermutation(vector<int>& nums) { int len = nums.size(); for(int i = len-1; i > 0 ; i--){ if(nums[i]> nums[i-1]){ sor 阅读全文
posted @ 2021-07-15 19:09 三一一一317 阅读(25) 评论(0) 推荐(0)
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2021-07-15 17:03 三一一一317 阅读(38) 评论(0) 推荐(0)
摘要: class Solution { public: vector<string> res; vector<string> generateParenthesis(int n) { if(n==0) return res; back("", n, n); return res; } void back( 阅读全文
posted @ 2021-07-15 16:51 三一一一317 阅读(41) 评论(0) 推荐(0)
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2021-07-15 15:55 三一一一317 阅读(38) 评论(0) 推荐(0)
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 23 下一页