size × size table and write the numbers from 1 to size² into it in a spiral: start at the top-left corner, move right, turn clockwise whenever you hit an edge or an already filled cell, and wind towards the centre.
Return the resulting table as a list of rows.size=2 → [[1, 2], [4, 3]]
1 and 2 go along the top row, then 3 drops into the bottom-right corner and 4 lands to its left.
size=4 → [[1, 2, 3, 4], [12, 13, 14, 5], [11, 16, 15, 6], [10, 9, 8, 7]]
The outer ring gets 1–12 and the inner 2 × 2 square gets 13–16.
size=1 → [[1]]
size=2
[[1, 2], [4, 3]]
Run checks the first 3 tests in your browser. Submit checks all 23 tests on the server, hidden ones included.