![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
回溯
ChenD17
这个作者很懒,什么都没留下…
展开
-
leetcode-200-岛屿数量
classSolution{public:vector<vector<int>>move={{0,1},{1,0},{0,-1},{-1,0}};//y,x右下左上voidmarkIslands(vector<vector<char>>&grid,inty,intx){...原创 2020-06-22 20:08:14 · 183 阅读 · 0 评论 -
leetcode-79-单词搜索
classSolution{public:vector<vector<int>>move={{0,1},{1,0},{0,-1},{-1,0}};//右下左上vector<vector<bool>>visited;booloutofArea(vector<vector<ch...原创 2020-06-22 20:08:32 · 121 阅读 · 0 评论 -
leetcode-90-子集II
classSolution{public:vector<vector<int>>res;intflag=0;voidhelper(vector<int>nums,intbegin,vector<int>curres){if(flag)res.push_back...原创 2020-06-22 20:08:04 · 120 阅读 · 0 评论 -
leetcode-40-组合总和II
classSolution{public:vector<vector<int>>res={};voidhelper(vector<int>&candidates,inttarget,intbegin,vector<int>curres){if(target==0)...原创 2020-06-22 20:08:51 · 99 阅读 · 0 评论 -
leetcode-39-组合总和
classSolution{public:vector<vector<int>>res={};voidhelper(vector<int>&candidates,inttarget,intbegin,vector<int>curres){if(target==...原创 2020-06-22 20:09:00 · 77 阅读 · 0 评论 -
leetcode-77-组合
classSolution{public:vector<vector<int>>res;voidhelper(intbegin,intn,intk,vector<int>curres){if(curres.size()==k)res.push_back(curres);...原创 2020-06-22 20:09:07 · 124 阅读 · 0 评论 -
leetcode-47-全排列II
classSolution{public:vector<bool>used;vector<vector<int>>res;voidhelper(vector<int>&nums,intindex,vector<int>curres){if(ind...原创 2020-06-22 20:09:35 · 171 阅读 · 0 评论 -
leetcode-46-全排列
classSolution{public:vector<vector<int>>res={};voidhelper(vector<int>nums,vector<int>curres){if(nums.size()==0)res.push_back(curres);...原创 2020-06-22 20:09:16 · 103 阅读 · 0 评论 -
leetcode-131-分割回文串
classSolution{public:vector<vector<string>>res;boolisHuiwen(strings){for(inti=0;i<s.length()/2;i++)if(s[i]!=s[s.length()-1-i])returnfa...原创 2020-06-22 20:10:24 · 227 阅读 · 0 评论 -
leetcode-17-电话号码的字母组合
//回溯法classSolution{vector<string>letter_map={"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};//0-9vector<string>res={};voidletterCombine(s...原创 2020-06-22 20:10:34 · 124 阅读 · 0 评论