Problem 59 · Medium

Spiral Matrix II

Fill an n by n matrix with consecutive numbers in clockwise spiral order. The visual writes values along the outer boundary and shrinks inward after each side.

Open the interactive visualisation