mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 15:31:43 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>你现在手里有一份大小为<meta charset=\"UTF-8\" /> <code>n x n</code> 的 网格 <code>grid</code>,上面的每个 单元格 都用 <code>0</code> 和 <code>1</code> 标记好了。其中 <code>0</code> 代表海洋,<code>1</code> 代表陆地。</p>\n\n<p>请你找出一个海洋单元格,这个海洋单元格到离它最近的陆地单元格的距离是最大的,并返回该距离。如果网格上只有陆地或者海洋,请返回 <code>-1</code>。</p>\n\n<p>我们这里说的距离是「曼哈顿距离」( Manhattan Distance):<code>(x0, y0)</code> 和 <code>(x1, y1)</code> 这两个单元格之间的距离是 <code>|x0 - x1| + |y0 - y1|</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/08/17/1336_ex1.jpeg\" /></strong></p>\n\n<pre>\n<strong>输入:</strong>grid = [[1,0,1],[0,0,0],[1,0,1]]\n<strong>输出:</strong>2\n<strong>解释: </strong>\n海洋单元格 (1, 1) 和所有陆地单元格之间的距离都达到最大,最大距离为 2。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/08/17/1336_ex2.jpeg\" /></strong></p>\n\n<pre>\n<strong>输入:</strong>grid = [[1,0,0],[0,0,0],[0,0,0]]\n<strong>输出:</strong>4\n<strong>解释: </strong>\n海洋单元格 (2, 2) 和所有陆地单元格之间的距离都达到最大,最大距离为 4。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<p><meta charset=\"UTF-8\" /></p>\n\n<ul>\n\t<li><code>n == grid.length</code></li>\n\t<li><code>n == grid[i].length</code></li>\n\t<li><code>1 <= n <= 100</code></li>\n\t<li><code>grid[i][j]</code> 不是 <code>0</code> 就是 <code>1</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 257,
|
||||
"likes": 265,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Shortest Distance from All Buildings\", \"titleSlug\": \"shortest-distance-from-all-buildings\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u79bb\\u5efa\\u7b51\\u7269\\u6700\\u8fd1\\u7684\\u8ddd\\u79bb\"}]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"42.8K\", \"totalSubmission\": \"90.8K\", \"totalAcceptedRaw\": 42822, \"totalSubmissionRaw\": 90781, \"acRate\": \"47.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"43.8K\", \"totalSubmission\": \"92.9K\", \"totalAcceptedRaw\": 43764, \"totalSubmissionRaw\": 92941, \"acRate\": \"47.1%\"}",
|
||||
"hints": [
|
||||
"Can you think of this problem in a backwards way ?",
|
||||
"Imagine expanding outward from each land cell. What kind of search does that ?",
|
||||
|
Reference in New Issue
Block a user