Skip to content

Commit 2d4819e

Browse files
committed
Create README - LeetHub
1 parent 733cf46 commit 2d4819e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

0885-spiral-matrix-iii/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h2><a href="https://leetcode.com/problems/spiral-matrix-iii/">885. Spiral Matrix III</a></h2><h3>Medium</h3><hr><div><p>You start at the cell <code>(rStart, cStart)</code> of an <code>rows x cols</code> grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column.</p>
2+
3+
<p>You will walk in a clockwise spiral shape to visit every position in this grid. Whenever you move outside the grid's boundary, we continue our walk outside the grid (but may return to the grid boundary later.). Eventually, we reach all <code>rows * cols</code> spaces of the grid.</p>
4+
5+
<p>Return <em>an array of coordinates representing the positions of the grid in the order you visited them</em>.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/08/24/example_1.png" style="width: 174px; height: 99px;">
10+
<pre><strong>Input:</strong> rows = 1, cols = 4, rStart = 0, cStart = 0
11+
<strong>Output:</strong> [[0,0],[0,1],[0,2],[0,3]]
12+
</pre>
13+
14+
<p><strong class="example">Example 2:</strong></p>
15+
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/08/24/example_2.png" style="width: 202px; height: 142px;">
16+
<pre><strong>Input:</strong> rows = 5, cols = 6, rStart = 1, cStart = 4
17+
<strong>Output:</strong> [[1,4],[1,5],[2,5],[2,4],[2,3],[1,3],[0,3],[0,4],[0,5],[3,5],[3,4],[3,3],[3,2],[2,2],[1,2],[0,2],[4,5],[4,4],[4,3],[4,2],[4,1],[3,1],[2,1],[1,1],[0,1],[4,0],[3,0],[2,0],[1,0],[0,0]]
18+
</pre>
19+
20+
<p>&nbsp;</p>
21+
<p><strong>Constraints:</strong></p>
22+
23+
<ul>
24+
<li><code>1 &lt;= rows, cols &lt;= 100</code></li>
25+
<li><code>0 &lt;= rStart &lt; rows</code></li>
26+
<li><code>0 &lt;= cStart &lt; cols</code></li>
27+
</ul>
28+
</div>

0 commit comments

Comments
 (0)