Collect all keys in grid
Your task
In a grid of characters, '.' is an open cell, '#' is a wall, '@' is your start, a lowercase letter is a key, and the matching uppercase letter is a locked door you can only pass once you hold that key. You move up/down/left/right one cell per step. Starting at '@', return the fewest steps to collect every key on the board (you may pass through doors only after picking up their key). Return -1 if it is impossible to collect all keys. Keys use distinct letters from 'a' to 'f' (at most 6).
Examples
shortest_path_keys(grid: list[str]) -> intExample 1
Input
shortest_path_keys(["@.a.A.b"])Output
6