State-space

3 articles

dsa8 min read

Open the Lock — BFS on State Space

Find the minimum number of turns to go from "0000" to the target combination on a 4-wheel lock, avoiding deadend states. Classic BFS on a finite state space — the lock combination is the node, each wheel turn is an edge.

Read →