Code RoomConveyor belt robot path
HardPrep Room Coding #1312

Conveyor belt robot path

CodingAlgorithms & data structuresSenior–Staff~40 min

A warehouse robot moves on a grid: 'S' start, 'T' target, '.' floor, '#' wall, and conveyor cells '^','v','<','>'. A normal step into an adjacent non-wall cell costs 1 move. When the robot lands on a conveyor cell it is immediately and freely pushed in the arrow's direction, repeatedly, until it reaches a non-conveyor cell. If a conveyor pushes the robot into a wall, off the grid, or into an infinite loop of conveyors, that landing is invalid. Return the minimum number of moves to reach 'T', or -1 if impossible. Exactly one 'S' and one 'T' (both on non-conveyor cells).

Implement
warehouse_min_steps(grid: list[list[str]]) → int
Examples
in[[["S",">","T"]]]out1
What a strong answer looks like

State 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.

0:00 of about 40 min
InputExpectedGot
[[["S",">","T"]]]1not run yetsample