Word Search / Path Finding in GridBacktracking Patterns

The Word Search / Path Finding in Grid pattern applies when you need the Word Search / Path Finding in Grid technique within the Backtracking Patterns pattern. Its time complexity is O(m × n × 4ᴸ) and space complexity O(L) recursion depth. It is used in 3 problems on Thita, including Check if Word Can Be Placed In Crossword, Word Search and Word Search II. Common variations are N-Queens / Constraint Satisfaction and Parentheses Generation.

Search for words in grid using backtracking. Handle visited cells and path restoration.

Word Search / Path Finding in Grid is one of the 7 subpatterns of the Backtracking Patterns pattern, which covers subsets, permutations, combinations, N-Queens, and word search. The whole pattern is about 3 hours of study. This subpattern is a core technique: expect it to come up directly in interviews.

What Word Search / Path Finding in Grid covers

Master backtracking algorithms including subsets, permutations, combinations, N-Queens, and word search. Exhaustive search with pruning for constraint satisfaction. Problems in this subpattern are usually searched for as word search, grid path finding, backtrack grid, DFS grid, leetcode 79, leetcode 212.

How to practise Word Search / Path Finding in Grid on Thita.ai

Read the theory for Word Search / Path Finding in Grid, then work the problems attached to it in the browser editor. Your solution runs against the problem's test cases, and the AI coach offers a hint about the technique you are missing rather than a finished solution. Progress is tracked per subpattern, so the Backtracking Patterns tracker shows this one as covered once you have solved its problems.

Other subpatterns in Backtracking Patterns

Related DSA patterns

Where to go next

Word Search / Path Finding in Grid is one lesson in a 16-pattern DSA course. If you are preparing end to end, work the interview-critical patterns first and use the pattern sheet as the checklist; if you are here for one technique, the Backtracking Patterns guide is the shortest path back to the rest of it.

Preparing this lesson and its course outline.