59. Spiral Matrix II
Medium — Matrix Simulation
Layer by Layer
Direction Vectors
Size n:
1
2
3
4
5
6
7
8
Apply
Play
Pause
Step
Reset
Speed:
Slow
Normal
Fast
Very Fast
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