Stage 1 · Code
Arrays & Hashing
Matrix Traversal
Spiral traversal, in-place rotation, and zero-setting — the O(1)-space matrix techniques that appear in every FAANG loop.
The Pattern
Matrix problems require careful boundary tracking. Spiral traversal uses four shrinking boundaries; in-place rotation uses a transpose + reflect trick; zeroing uses first row/col as markers to avoid extra space.
For spiral traversal, maintain top, bottom, left, right pointers. After traversing each edge, shrink the corresponding boundary inward. The loop continues while top ≤ bottom and left ≤ right.
Problems
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.