← Questions
Shortest path to collect all keys
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A grid has walls, a start cell, keys (lowercase letters) and locks (the matching uppercase letters). A lock can only be passed once you hold its key. Return the fewest steps to collect every key, or -1. Run a breadth-first search over states made of the position and the set of keys held, stored as a bitmask.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
