54. Spiral Matrix
Problem Statement
Given an m x n
matrix
, return all elements of the matrix
in spiral order.
Example 1:
Example 2:
Constraints:
m == matrix.length
n == matrix[i].length
1 <= m, n <= 10
-100 <= matrix[i][j] <= 100
Intuition
Links
https://leetcode.com/problems/spiral-matrix/description/
Video Links
https://www.youtube.com/watch?v=3Zv-s9UUrFM
Approach 1:
C++
Approach 2:
C++
Approach 3:
C++
Approach 4:
C++
Similar Problems
Last updated