Skip to main content

Practice · 2 of 3

Keyed Maze

CHALLENGE
Difficulty: advanced+25 XP

**Problem.** A grid maze: '.', '#', 'S' (start), 'E' (exit), 'K' (key), 'D' (locked door — passable only after picking up the key). Print the minimum number of steps from S to E, or -1. **Constraints:** 1 <= R, C <= 500. **R versus W.** The graded wrong solution runs BFS without the key state.

Back to lesson: Practice: Mixed Drill — Final Synthesis