# 力扣54. 螺旋矩阵


## 力扣54. Spiral Matrix（螺旋矩阵）

给你一个 m 行 n 列的矩阵 matrix，请按照顺时针螺旋顺序，返回矩阵中的所有元素。

示例 1：

![](../posts/01_学习/87_LeetCode/0054_螺旋矩阵/img/0054-1-description.png)

```
输入：matrix = [[1,2,3],[4,5,6],[7,8,9]]
输出：[1,2,3,6,9,8,7,4,5]
```

示例 2：

![](../posts/01_学习/87_LeetCode/0054_螺旋矩阵/img/0054-2-description.png)

```
输入：matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
输出：[1,2,3,4,8,12,11,10,9,5,6,7]
```

提示：
- m == matrix.length
- n == matrix[i].length
- 1 <= m, n <= 10
- -100 <= matrix[i][j] <= 100

