给定一个正整数 n,生成一个包含 1 到 n<sup>2</sup> 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。 **示例:** ``` 输入: 3 输出: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ] ``` [leetcode](https://leetcode-cn.com/problems/spiral-matrix-ii)