mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-09 01:11:42 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个下标从 <strong>0</strong> 开始,大小为 <code>m x n</code> 的二进制矩阵 <code>land</code> ,其中 <code>0</code> 表示一单位的森林土地,<code>1</code> 表示一单位的农场土地。</p>\n\n<p>为了让农场保持有序,农场土地之间以矩形的 <strong>农场组</strong> 的形式存在。每一个农场组都 <strong>仅</strong> 包含农场土地。且题目保证不会有两个农场组相邻,也就是说一个农场组中的任何一块土地都 <strong>不会</strong> 与另一个农场组的任何一块土地在四个方向上相邻。</p>\n\n<p><code>land</code> 可以用坐标系统表示,其中 <code>land</code> 左上角坐标为 <code>(0, 0)</code> ,右下角坐标为 <code>(m-1, n-1)</code> 。请你找到所有 <b>农场组</b> 最左上角和最右下角的坐标。一个左上角坐标为 <code>(r<sub>1</sub>, c<sub>1</sub>)</code> 且右下角坐标为 <code>(r<sub>2</sub>, c<sub>2</sub>)</code> 的 <strong>农场组</strong> 用长度为 4 的数组 <code>[r<sub>1</sub>, c<sub>1</sub>, r<sub>2</sub>, c<sub>2</sub>]</code> 表示。</p>\n\n<p>请你返回一个二维数组,它包含若干个长度为 4 的子数组,每个子数组表示 <code>land</code> 中的一个 <strong>农场组</strong> 。如果没有任何农场组,请你返回一个空数组。可以以 <strong>任意顺序</strong> 返回所有农场组。</p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/07/27/screenshot-2021-07-27-at-12-23-15-copy-of-diagram-drawio-diagrams-net.png\" style=\"width: 300px; height: 300px;\"></p>\n\n<pre><b>输入:</b>land = [[1,0,0],[0,1,1],[0,1,1]]\n<b>输出:</b>[[0,0,0,0],[1,1,2,2]]\n<strong>解释:</strong>\n第一个农场组的左上角为 land[0][0] ,右下角为 land[0][0] 。\n第二个农场组的左上角为 land[1][1] ,右下角为 land[2][2] 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/07/27/screenshot-2021-07-27-at-12-30-26-copy-of-diagram-drawio-diagrams-net.png\" style=\"width: 200px; height: 200px;\"></p>\n\n<pre><b>输入:</b>land = [[1,1],[1,1]]\n<b>输出:</b>[[0,0,1,1]]\n<strong>解释:</strong>\n第一个农场组左上角为 land[0][0] ,右下角为 land[1][1] 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/07/27/screenshot-2021-07-27-at-12-32-24-copy-of-diagram-drawio-diagrams-net.png\" style=\"width: 100px; height: 100px;\"></p>\n\n<pre><b>输入:</b>land = [[0]]\n<b>输出:</b>[]\n<b>解释:</b>\n没有任何农场组。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>m == land.length</code></li>\n\t<li><code>n == land[i].length</code></li>\n\t<li><code>1 <= m, n <= 300</code></li>\n\t<li><code>land</code> 只包含 <code>0</code> 和 <code>1</code> 。</li>\n\t<li>农场组都是 <strong>矩形</strong> 的形状。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 6,
|
||||
"likes": 8,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4K\", \"totalSubmission\": \"6.7K\", \"totalAcceptedRaw\": 4003, \"totalSubmissionRaw\": 6725, \"acRate\": \"59.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"4.1K\", \"totalSubmission\": \"6.9K\", \"totalAcceptedRaw\": 4129, \"totalSubmissionRaw\": 6930, \"acRate\": \"59.6%\"}",
|
||||
"hints": [
|
||||
"Since every group of farmland is rectangular, the top left corner of each group will have the smallest x-coordinate and y-coordinate of any farmland in the group.",
|
||||
"Similarly, the bootm right corner of each group will have the largest x-coordinate and y-coordinate of any farmland in the group.",
|
||||
|
Reference in New Issue
Block a user