Question
You're navigating a grid: 'S' is the start, 'E' the exit, '.' is walkable, '#' is a wall. Each lowercase letter marks a portal; portals that share the same letter are linked, and standing on one lets you teleport to its partner tile at no movement cost (exactly two tiles per letter). Walking to an orthogonally adjacent non-wall tile costs 1 step. Return the minimum number of steps to get from S to E, or -1 if unreachable.
portal_maze(grid: list[str]) → int[["S.a..","###.#","E.a.."]]out4State 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.