dsa2 min read
Word Search I & II: DFS Backtracking on Grid
Search for words in a character grid using DFS backtracking. Word Search II uses a Trie for simultaneous multi-word search.
Read →
1575 articles
Search for words in a character grid using DFS backtracking. Word Search II uses a Trie for simultaneous multi-word search.
Generate all valid parentheses combinations of length 2n using open/close count tracking. Classic backtracking interview problem.
Solve a 9x9 Sudoku board with backtracking enhanced by constraint propagation (arc consistency) for dramatic pruning.
Solve the N-Queens problem with backtracking using column/diagonal conflict tracking. O(n!) with early pruning.
Generate all k-combinations and find combinations summing to target. Master the start-index pattern to avoid duplicates.