LeetCode questions conclustion_BFS, DFS

BFS, DFS 的题目总结. 

Directed graph:

Directed Graph Loop detection and if not have, path to print all path.

BFS/DFS: (可以用BFS或者DFS的,主要还是遍历)

 [LeetCode] 733. Flood Fill_Easy tag: BFS

[LeetCode] 690. Employee Importance_Easy tag: BFS

[LeetCode] 529. Minesweeper_ Medium_ tag: BFS

[LeetCode] 200. Number of Islands_ Medium tag: BFS

[LeetCode] 133. Clone Graph_ Medium tag: BFS, DFS

[LeetCode] 261. Graph Valid Tree _ Medium tag: BFS

[LeetCode] 301. Remove Invalid Parentheses_Hard tag:BFS

[LeetCode] 104. Maximum Depth of Binary Tree_Easy tag: DFS

[LeetCode] 827. Making A Large Island

BFS(shortest path/distance, level traversal)

[Leetcode] 863. All Nodes Distance K in Binary Tree_ Medium tag: BFS, Amazon

[LeetCode] 199. Binary Tree Right Side View_ Medium tag: BFS, Amazon

[LeetCode] 102. Binary Tree Level Order Traversal_Medium tag: BFS

[LeetCode] 127. Word Ladder _Medium tag: BFS

[LeetCode] 675. Cut Off Trees for Golf Event_Hard tag: BFS

[LeetCode] 103. Binary Tree Zigzag Level Order Traversal _ Medium tag: BFS

[LeetCode] 101. Symmetric Tree_ Easy tag: BFS

[LeetCode] 513. Find Bottom Left Tree Value_ Medium tag: BFS

[LeetCode] 286. Walls and Gates_Medium tag: BFS

[LeetCode] 116&117. Populating Next Right Pointers in Each Node I&II_Medium tag: BFS(Dont know why leetcode tag it as DFS...)

DFS

[LeetCode] 207 Course Schedule_Medium tag: BFS, DFS

[LeetCode] 785. Is Graph Bipartite?_Medium tag: DFS, BFS

[LeetCode] 210. Course Schedule II

[LeetCode] 694. Number of Distinct Islands

[LeetCode] 711. Number of Distinct Islands II_hard tag: DFS

[LeetCode] 851. Loud and Rich_ Medium tag: DFS

[LeetCode] 112. Path Sum_Easy tag: DFS

[LeetCode] 114. Flatten Binary Tree to Linked List_Medium tag: DFS

[LeetCode] 257. Binary Tree Paths_ Easy tag: DFS

[LeetCode] 113. Path Sum II

猜你喜欢

转载自www.cnblogs.com/Johnsonxiong/p/9321286.html