mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part6
This commit is contained in:
28
算法题(国内版)/problem (Chinese)/螺旋矩阵 [spiral-matrix].html
Normal file
28
算法题(国内版)/problem (Chinese)/螺旋矩阵 [spiral-matrix].html
Normal file
@@ -0,0 +1,28 @@
|
||||
<p>给你一个 <code>m</code> 行 <code>n</code> 列的矩阵 <code>matrix</code> ,请按照 <strong>顺时针螺旋顺序</strong> ,返回矩阵中的所有元素。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2020/11/13/spiral1.jpg" style="width: 242px; height: 242px;" />
|
||||
<pre>
|
||||
<strong>输入:</strong>matrix = [[1,2,3],[4,5,6],[7,8,9]]
|
||||
<strong>输出:</strong>[1,2,3,6,9,8,7,4,5]
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2020/11/13/spiral.jpg" style="width: 322px; height: 242px;" />
|
||||
<pre>
|
||||
<strong>输入:</strong>matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
|
||||
<strong>输出:</strong>[1,2,3,4,8,12,11,10,9,5,6,7]
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>m == matrix.length</code></li>
|
||||
<li><code>n == matrix[i].length</code></li>
|
||||
<li><code>1 <= m, n <= 10</code></li>
|
||||
<li><code>-100 <= matrix[i][j] <= 100</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user