Spiral Matrix
Medium📝 Description
Return all elements in spiral order
Input Format
2D matrix
Output Format
Elements in spiral order
Constraints
m == matrix.length
🔍 Sample Input
[[1,2,3],[4,5,6],[7,8,9]]
✅ Sample Output
[1,2,3,6,9,8,7,4,5]
Code Editor
Please login to run and submit code.
Results
Suggested Solution
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run