Question
Given a grid of characters where '.' is open, '#' is a wall, '@' is the single start, lowercase 'a'..'f' are keys, and uppercase 'A'..'F' are matching locked doors, return the fewest moves (up/down/left/right) to collect every key that exists in the grid. You may walk over a key cell to pick it up; you may only enter a door cell if you already hold its matching key. Return -1 if collecting all keys is impossible. There are at most 6 distinct keys.
shortest_path_all_keys(grid: list[str]) → int[["@.a.#","###.#","b.A.B"]]out8State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.