Search
⌘K

Leetcode 752. Open the Lock

Find the minimum number of single-digit rotations to change the 4-wheel lock from "0000" to the target (each digit 0–9 wraps around), while avoiding given deadend codes that block states; return -1 if unreachable. Core challenge: shortest-path search in an implicit 10^4-state graph with forbidden nodes (BFS/bidirectional-BFS pattern).

Asked at:

Meta


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid September, 2025

Meta

Senior

Late April, 2025

Meta

Mid-level

Comments

Your account is free and you can post anonymously if you choose.