59. Spiral Matrix II

Medium — Matrix Simulation

Layer by Layer
Direction Vectors
Press "Play" or "Step" to fill the matrix.

Step

0 / 0

Value

0

Cells filled

0

Direction

Current cell
Active band
Filled
Empty
Algorithm Complexity
Layer by Layer
O(n²) / O(1)
Time / Space: O(n²) / O(1) extra
Direction Vectors
O(n²) / O(1)
Time / Space: O(n²) / O(1) extra