LeetCode 752 Open the Lock - Why Naive Fails

Why brute force fails

Try all possible sequences of turns using DFS, tracking the shortest path to target.

With 4 wheels × 2 directions, each state has 8 neighbors. The search tree explodes exponentially.

BFS naturally finds the shortest path. Can you explore level by level?