Shuttle through rotating carousel
An automated warehouse runs a shuttle across a rectangular floor. Every cell carries a repeating schedule string, and all of the schedules have the same length L. Character t of a cell's schedule is '.' when that cell is clear during minute t and '#' when a rotating carousel fills it, and the schedule repeats forever, so minute t reads character t mod L. The shuttle stands on the top left cell at minute 0. Between one minute and the next it either waits where it is or steps to an orthogonally adjacent cell, and it must be standing on a clear cell at every minute, minute 0 included. Return the earliest minute at which it can be standing on the bottom right cell, or -1 when no sequence of waits and steps ever puts it there. The floor has at least one cell and L is at least 1.
shuttle_transit_time(floor: list[list[str]]) → int[[["..",".#"],[".#",".."]]]out3[[["...","..."],["...","..."]]]out2[[["#."],[".."]]]out-1State 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.
[[["..",".#"],[".#",".."]]]3not run yetsample[[["...","..."],["...","..."]]]2not run yetsample[[["#."],[".."]]]-1not run yetsample