Depth-First Search
Explore as deep as possible, then backtrack. LC 200, 695, 79, 130.
Unvisited
Current
Backtracking
Visited
Controls
Click cells to toggle walls.
Time: O(V+E) | Space: O(V)
Stack
0 stepsPress Run DFS to trace the algorithm one step at a time.