Search
⌘K
Leetcode 54. Spiral Matrix
Traverse the m×n matrix in clockwise spiral order (right, down, left, up) and return the elements in that sequence. The core challenge is managing changing boundaries or directions (layer-by-layer traversal) so each element is visited exactly once.
Asked at:
L
LiveRamp
Microsoft
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Early January, 2026
Microsoft
Senior
Phone screen
Late October, 2025
Microsoft
Mid-level
Early October, 2025
Meta
Staff
Traverse a matrix in the spiral order starting from (0, 0). How can it be modified if we need to traverse it from any arbitrary cell?
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.