mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 14:12:17 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个 <code><em>m</em> x <em>n</em></code> 的矩阵,如果一个元素为 <strong>0 </strong>,则将其所在行和列的所有元素都设为 <strong>0</strong> 。请使用 <strong><a href=\"http://baike.baidu.com/item/%E5%8E%9F%E5%9C%B0%E7%AE%97%E6%B3%95\" target=\"_blank\">原地</a></strong> 算法<strong>。</strong></p>\n\n<ul>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/08/17/mat1.jpg\" style=\"width: 450px; height: 169px;\" />\n<pre>\n<strong>输入:</strong>matrix = [[1,1,1],[1,0,1],[1,1,1]]\n<strong>输出:</strong>[[1,0,1],[0,0,0],[1,0,1]]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/08/17/mat2.jpg\" style=\"width: 450px; height: 137px;\" />\n<pre>\n<strong>输入:</strong>matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]]\n<strong>输出:</strong>[[0,0,0,0],[0,4,5,0],[0,3,1,0]]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>m == matrix.length</code></li>\n\t<li><code>n == matrix[0].length</code></li>\n\t<li><code>1 <= m, n <= 200</code></li>\n\t<li><code>-2<sup>31</sup> <= matrix[i][j] <= 2<sup>31</sup> - 1</code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong></p>\n\n<ul>\n\t<li>一个直观的解决方案是使用 <code>O(<em>m</em><em>n</em>)</code> 的额外空间,但这并不是一个好的解决方案。</li>\n\t<li>一个简单的改进方案是使用 <code>O(<em>m</em> + <em>n</em>)</code> 的额外空间,但这仍然不是最好的解决方案。</li>\n\t<li>你能想出一个仅使用常量空间的解决方案吗?</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 689,
|
||||
"likes": 711,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Game of Life\", \"titleSlug\": \"game-of-life\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u751f\\u547d\\u6e38\\u620f\"}]",
|
||||
@@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"172.4K\", \"totalSubmission\": \"280.2K\", \"totalAcceptedRaw\": 172433, \"totalSubmissionRaw\": 280185, \"acRate\": \"61.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"180.1K\", \"totalSubmission\": \"292K\", \"totalAcceptedRaw\": 180128, \"totalSubmissionRaw\": 291976, \"acRate\": \"61.7%\"}",
|
||||
"hints": [
|
||||
"If any cell of the matrix has a zero we can record its row and column number using additional memory.\r\nBut if you don't want to use extra memory then you can manipulate the array instead. i.e. simulating exactly what the question says.",
|
||||
"Setting cell values to zero on the fly while iterating might lead to discrepancies. What if you use some other integer value as your marker?\r\nThere is still a better approach for this problem with 0(1) space.",
|
||||
|
Reference in New Issue
Block a user