1/25
Loading...
🐌Spiral Matrix
Fill the array clockwise like a snail shell! 🐌 Direction order: → Right → Down → Left → Up Change direction when hitting boundary or filled cell.
Loading...
Fill the array clockwise like a snail shell! 🐌 Direction order: → Right → Down → Left → Up Change direction when hitting boundary or filled cell.
Spiral matrix fills a 2D array from outside to inside in clockwise order (→↓←↑). It changes direction when hitting a boundary or already filled cell.