Dsa
Matrix
Hard
Matrix Spiral Traversal
Given an m x n matrix of integers, return all elements of the matrix in spiral order.
Example:
Input:
1 2 3
4 5 6
7 8 9
Output:
1 2 3 6 9 8 7 4 5
Key concepts
matrixtraversalspiral
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now