Tag
DFS
Language
Depth-First Search: Exploring Deep Before Wide
#DFS#Tree#Graph#RecursionUnderstanding Recursion: Functions That Call Themselves
Recursion is a core computational concept where a problem is solved by calling itself on smaller instances. Recursion is key to many algorithms: DFS (Depth-First Search) is often implemented recursively, Dynamic Programming is fundamentally recursion with caching (memoization), and Divide & Conquer uses recursion to split problems into independent subproblems.
#Recursion#DFS#Dynamic Programming#Divide & Conquer[Leetcode 17] 电话号码的字母组合
字符串能表示的所有字母组合
#回溯#BFS#DFS[Leetcode 39] 组合和
给定无重复正整数数组 candidates,每个数可重复使用,返回所有和为 target 的不重复组合。
#回溯#DFS[Leetcode 101] 对称二叉树
给定一个二叉树的根节点root,检查它是否轴对称。
#二叉树#DFS#BFS[Leetcode 102] 二叉树的层序遍历
逐层地,从左到右访问二叉树的所有节点
#二叉树#DFS#BFS[Leetcode 124] 二叉树中的最大路径和
二叉树中任意两节点之间路径的最大和,,路径不要求经过根节点。
#二叉树#DFS[Leetcode 126] 单词接龙 II
所有从beginWord转化到endWord的最短转换序列
#BFS#DFS#回溯[Leetcode 140]单词拆分 II
给定字符串 s 和词典 wordDict,返回所有能把 s 拆成词典单词的句子。
#DFS#回溯#动态规划#Tries[Leetcode 200] 岛屿数量
网格中被水(0)包围的岛屿的数量
#DFS#BFS#并查集[Leetcode 236] 二叉树的最近公共祖先
给定一个二叉树, 找到该树中两个指定节点的最近公共祖先。
#二叉树#DFS#BFS[Leetcode 403] 青蛙过河
给定递增数组 stones 表示石子位置,青蛙能否在「下一跳距离与上一跳之差不超过 1」的约束下,从第一块石子跳到最后一块石子。
#动态规划#DFS#哈希