The problem
Turn one wheel of a four-digit lock one position per move. Find the minimum moves from 0000 to the target without visiting a forbidden combination.
Tags Graph search
Related topics Bidirectional BFS & Dijkstra, Breadth-First Search (BFS) & Multi-Source BFS, Hash Set
Original problem on LeetCode ↗