Package g0001_0100.s0054_spiral_matrix
Class Solution
java.lang.Object
g0001_0100.s0054_spiral_matrix.Solution
54 - Spiral Matrix.<p>Medium</p>
<p>Given an <code>m x n</code> <code>matrix</code>, return <em>all elements of the</em> <code>matrix</code> <em>in spiral order</em>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/11/13/spiral1.jpg" alt="" /></p>
<p><strong>Input:</strong> matrix = [[1,2,3],[4,5,6],[7,8,9]]</p>
<p><strong>Output:</strong> [1,2,3,6,9,8,7,4,5]</p>
<p><strong>Example 2:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/11/13/spiral.jpg" alt="" /></p>
<p><strong>Input:</strong> matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]</p>
<p><strong>Output:</strong> [1,2,3,4,8,12,11,10,9,5,6,7]</p>
<p><strong>Constraints:</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>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
spiralOrder
-