Code RoomRobot floor traversal
EasyPrep Room Coding #4703

Robot floor traversal

CodingAlgorithms & data structuresEntry–Mid~15 min

An overnight cleaning robot works a terminal floor plan given as a rectangular grid of single character cells, where '.' is open floor and '#' is a fixed obstacle such as a kiosk or a gate desk. The robot starts on the open cell at start_row and start_col, then reads the instruction string one character at a time. 'N' moves it one row up, 'S' one row down, 'E' one column right, and 'W' one column left. An instruction that would carry it off the plan or onto an obstacle is refused: the robot stays where it is and goes on to the next instruction. Return the cell it finishes on as [row, column]. An empty instruction string leaves it on its starting cell.

Implement
final_stop_cell(plan: list[list[str]], start_row: int, start_col: int, moves: str) → list[int]
Examples
in[[[".",".","."],[".","#","."],[".",".","."]],0,0,"SSEE"]out[2,2]
in[[[".",".","."],[".","#","."],[".",".","."]],0,0,"SE"]out[1,0]
in[[[".",".","."],[".","#","."],[".",".","."]],0,0,"NNNNWWWW"]out[0,0]
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 15 min
InputExpectedGot
[[[".",".","."],[".","#","."],[".",".","."]],0,0,"SSEE"][2,2]not run yetsample
[[[".",".","."],[".","#","."],[".",".","."]],0,0,"SE"][1,0]not run yetsample
[[[".",".","."],[".","#","."],[".",".","."]],0,0,"NNNNWWWW"][0,0]not run yetsample