Spiral Scan
Mediummatrixsimulation
A radar scans a rectangular arena grid in a clockwise spiral: along the top row from left to right, down the right column, back along the bottom row, up the left column, then inward.
Return the values of grid in the order the radar visits them. The grid may be empty.
Examples
Input: grid = [[1,2,3],[4,5,6],[7,8,9]]
Output: [1,2,3,6,9,8,7,4,5]
Input: grid = [[1,2],[3,4],[5,6]]
Output: [1,2,4,6,5,3]