Search
⌘K

Leetcode 864. Shortest Path to Get All Keys

Find the minimum number of moves from the start to collect all keys in a grid containing walls and locks (locks are passable only if you have their corresponding key). The core challenge is shortest-path search on an augmented state space (row, column, collected-keys bitmask — k ≤ 6), typically solved with BFS over O(m·n·2^k) states; return -1 if unreachable.


Question Timeline

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

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