rows rows and cols columns; row 0 is at the top and column 0 is on the left. A robot stands in cell (start_row, start_col) facing east (towards larger column numbers).
It walks along an unwinding clockwise spiral: 1 step east, 1 south, 2 west, 2 north, 3 east, 3 south, 4 west, and so on. When the spiral takes it off the field, the robot keeps walking outside; it will come back later.
Return the [row, column] coordinates of every cell of the field in the order the robot first reaches them, starting with the starting cell. The walk ends as soon as all rows · cols cells have been visited.rows=2, cols=3, start_row=0, start_col=1 → [[0, 1], [0, 2], [1, 2], [1, 1], [1, 0], [0, 0]]
Start at (0, 1): one step east to (0, 2), south to (1, 2), two steps west to (1, 1) and (1, 0), then north to (0, 0). All 6 cells are collected at that point.
rows=3, cols=1, start_row=2, start_col=0 → [[2, 0], [1, 0], [0, 0]]
All steps of the first lap (1 east, 1 south, 2 west, 2 north) stay outside the field. The robot meets cell (1, 0) during the 3 steps east, and reaches (0, 0) even later, during the 5 steps east.
rows=1, cols=1, start_row=0, start_col=0 → [[0, 0]]
rows=2, cols=3, start_row=0, start_col=1
[[0, 1], [0, 2], [1, 2], [1, 1], [1, 0], [0, 0]]
Run checks the first 3 tests in your browser. Submit checks all 77 tests on the server, hidden ones included.