标签: dfs
-
leetcode472-Concatenated-Words
Given a list of words (without duplicates), please writ…
-
leetcode473-Matchsticks-to-Square
Remember the story of Little Match Girl? By now, you kn…
-
leetcode427-Construct-Quad-Tree
We want to use quad trees to store an N x N boolean gri…
-
leetcode491-Increasing-Subsequences
这里采用深度优先的思路进行解决。先将数组按照从小到大排序,再从左往右遍历数组,每个数字有两种可能,分别是选中到…
-
广度优先深度优先寻求最短路径
打印结果广度优先搜索:name:v0name:v2name:v3name:v1name:v4深度优先搜索:na…
-
leetcode430-Flatten-a-Multilevel-Doubly-Linked-List
从深度优先遍历的角度来看,每次遇到一个包含子节点中间双链表节点,就递归的调用展开方法将其展开,并将展开的结果插…
-
leetcode403. Frog Jump
假设有一只青蛙需要过河,河中会有一些石子,青蛙必须踩在石头上才算成功。石头的位置用整数数组来表示。青蛙的行走规…
-
leetcode394. Decode String
将一个字符串解码,要求按照次数展开原字符串中的中括号。如3[a]2[bc]对应的字符串就是aaabcbc,即a…
-
[LeetCode] 51. N-Queens
The n-queens puzzle is the problem of placing n queens …
-
[LeetCode] 332. Reconstruct Itinerary
Given a list of airline tickets represented by pairs of…