dfs
共 39 篇文章
leetcode113. 路径总和 II
暂无摘要...
leetcode216. 组合总和 III
暂无摘要...
leetcode473. 火柴拼正方形
暂无摘要...
leetcode22. 括号生成
暂无摘要...
leetcode200. 岛屿数量
暂无摘要...
leetcode93. 复原 IP 地址
暂无摘要...
leetcode90. 子集 II
暂无摘要...
leetcode79. 单词搜索
分析对每个位置进行dfs遍历,每次dfs搜索时向四个方向拓展,如果超出边界或者已经访问过则放弃这个位置,其他情况再次进行dfs遍历,一直到与单词完全匹配时返回true;typedef pair<int ,int > PII;class Solution {public: int d
leetcode78. 子集
分析优秀题解链接class Solution {public: vector<vector<int>> ans; vector<int>path; void dfs(int u,vector<int>& nums){
leetcode77. 组合
class Solution {public: vector<vector<int>>ans; vector<int>path; void dfs(int u,int n,int k){ if(path.size()+n-u+1&l