DFS & BFS & BackTrack
Trees
TreeDFS/BFS
Find cycle 207. Course Schedule
DFS
No. 93: Restore IP Addresses
No. 282: Expression Add Operators
No. 399: Evaluate Division
No. 78 Subsets
No.90 Subsets I
BFS
No. 127. Word Ladder
No. 126. Word Ladder || (Bidirectional BFS)
BackTrack
No. 22: Generate Parentheses: DFS backtrack
Mixed DFS/BFS + Backtrack + Memorization ⭐️⭐️⭐️⭐️⭐️
79. Word Search – DFS
Pruning: consider freq, can reverse the word, start from low freq.
212. Word Search II – backtracking + trie
329. Longest Increasing Path in a Matrix – DFS + DP memoization
140. Word Break II – DFS + memoization (backtracking with DP)
694. Number of Distinct Islands – DFS + canonical shape representation
301. Remove Invalid Parentheses – backtracking + pruning
Last updated