Skip to main content

Word Search (Backtracking)

Learn Word Search (Backtracking) (Recursion & Backtracking, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Finding One Word in a Letter Grid Given a grid of letters and a single target word, check if the word can be formed by a path of ADJACENT cells (no cell reused within one path). DFS from every starting cell, backtracking (temporarily marking cells visited, then un-marking) whenever a path doesn't pan out.

More lessons in Recursion & Backtracking