1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-24 14:28:56 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个由若干 <code>0</code> 和 <code>1</code> 组成的二维网格 <code>grid</code> ,其中 <code>0</code> 表示水,而 <code>1</code> 表示陆地。岛屿由水平方向或竖直方向上相邻的 <code>1</code> (陆地)连接形成。</p>\n\n<p>如果 <strong>恰好只有一座岛屿 </strong>,则认为陆地是 <strong>连通的</strong> ;否则,陆地就是 <strong>分离的</strong> 。</p>\n\n<p>一天内,可以将任何单个陆地单元(<code>1</code>)更改为水单元(<code>0</code>)。</p>\n\n<p>返回使陆地分离的最少天数。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<p><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/08/30/1926_island.png\" style=\"height: 139px; width: 498px;\"></strong></p>\n\n<pre><strong>输入:</strong>grid = [[0,1,1,0],[0,1,1,0],[0,0,0,0]]\n<strong>输出:</strong>2\n<strong>解释:</strong>至少需要 2 天才能得到分离的陆地。\n将陆地 grid[1][1] 和 grid[0][2] 更改为水,得到两个分离的岛屿。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>grid = [[1,1]]\n<strong>输出:</strong>2\n<strong>解释:</strong>如果网格中都是水,也认为是分离的 ([[1,1]] -&gt; [[0,0]])0 岛屿。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>grid = [[1,0,1,0]]\n<strong>输出:</strong>0\n</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre><strong>输入:</strong>grid = [[1,1,0,1,1],\n&nbsp; [1,1,1,1,1],\n&nbsp; [1,1,0,1,1],\n&nbsp; [1,1,0,1,1]]\n<strong>输出:</strong>1\n</pre>\n\n<p><strong>示例 5</strong></p>\n\n<pre><strong>输入:</strong>grid = [[1,1,0,1,1],\n&nbsp; [1,1,1,1,1],\n&nbsp; [1,1,0,1,1],\n&nbsp; [1,1,1,1,1]]\n<strong>输出:</strong>2\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= grid.length, grid[i].length &lt;= 30</code></li>\n\t<li><code>grid[i][j]</code> 为 <code>0</code> 或 <code>1</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 35,
"likes": 37,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"3K\", \"totalSubmission\": \"6.5K\", \"totalAcceptedRaw\": 2974, \"totalSubmissionRaw\": 6476, \"acRate\": \"45.9%\"}",
"stats": "{\"totalAccepted\": \"3K\", \"totalSubmission\": \"6.6K\", \"totalAcceptedRaw\": 3024, \"totalSubmissionRaw\": 6610, \"acRate\": \"45.7%\"}",
"hints": [
"Return 0 if the grid is already disconnected.",
"Return 1 if changing a single land to water disconnect the island.",