Problem 54 · Medium

Spiral Matrix

Return the matrix values in clockwise spiral order. The visual traverses the outer edges in turn and shrinks the boundary after each side.

Open the interactive visualisation