← All problemsSign in

864. Shortest Path to Get All Keys

LeetCodeArrayBit ManipulationBreadth-First SearchMatrixOpen on judge ↗

You are given an m x n grid grid where: - '.' is an empty cell. - '#' is a wall. - '@' is the starting point. - Lowercase letters represent keys. - Uppercase letters represent locks. You start at the starting point and one move consists of walking one space in one of the four cardinal directions. You cannot walk outside the grid, or walk into a wall. If you walk over a key, you can pick it

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start