Skip to content

Commit 3d4962d

Browse files
committed
Create README - LeetHub
1 parent abf332d commit 3d4962d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

0073-set-matrix-zeroes/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<h2><a href="https://leetcode.com/problems/set-matrix-zeroes/">73. Set Matrix Zeroes</a></h2><h3>Medium</h3><hr><div><p>Given an <code>m x n</code> integer matrix <code>matrix</code>, if an element is <code>0</code>, set its entire row and column to <code>0</code>'s.</p>
2+
3+
<p>You must do it <a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank">in place</a>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
<img alt="" src="https://assets.leetcode.com/uploads/2020/08/17/mat1.jpg" style="width: 450px; height: 169px;">
8+
<pre><strong>Input:</strong> matrix = [[1,1,1],[1,0,1],[1,1,1]]
9+
<strong>Output:</strong> [[1,0,1],[0,0,0],[1,0,1]]
10+
</pre>
11+
12+
<p><strong class="example">Example 2:</strong></p>
13+
<img alt="" src="https://assets.leetcode.com/uploads/2020/08/17/mat2.jpg" style="width: 450px; height: 137px;">
14+
<pre><strong>Input:</strong> matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]]
15+
<strong>Output:</strong> [[0,0,0,0],[0,4,5,0],[0,3,1,0]]
16+
</pre>
17+
18+
<p>&nbsp;</p>
19+
<p><strong>Constraints:</strong></p>
20+
21+
<ul>
22+
<li><code>m == matrix.length</code></li>
23+
<li><code>n == matrix[0].length</code></li>
24+
<li><code>1 &lt;= m, n &lt;= 200</code></li>
25+
<li><code>-2<sup>31</sup> &lt;= matrix[i][j] &lt;= 2<sup>31</sup> - 1</code></li>
26+
</ul>
27+
28+
<p>&nbsp;</p>
29+
<p><strong>Follow up:</strong></p>
30+
31+
<ul>
32+
<li>A straightforward solution using <code>O(mn)</code> space is probably a bad idea.</li>
33+
<li>A simple improvement uses <code>O(m + n)</code> space, but still not the best solution.</li>
34+
<li>Could you devise a constant space solution?</li>
35+
</ul>
36+
</div>

0 commit comments

Comments
 (0)