Backtracking pattern
Word Search
Given a grid of characters and a target word, return whether the word can be formed by a path of 4-directionally adjacent cells, where each cell may be used at most once. Watch it run step by step, then write your own pseudocode and get it checked by AI.
- LeetCode 79
- Medium
- 1 approach
Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.
BacktrackingLeetCode 79
Medium
The approach
- 01 Backtracking · DFS mark & unmark O(R·C·4ᴸ)O(L) space
What you will learn
- How to read Word Search and spot the backtracking pattern in it
- Backtracking · DFS mark & unmark: O(R·C·4ᴸ) time, O(L) space
- The pseudocode for each approach, its line lit as the animation runs
- Practice: write your own pseudocode and get it checked
More Backtracking
See Word Search run, step by step
Sign in and this page opens on the animation, with all 8 Backtracking problems beside it.
DSA comes with the all labs plan and every ChaiCode batch.