mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-12-18 18:14:59 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>你准备参加一场远足活动。给你一个二维 <code>rows x columns</code> 的地图 <code>heights</code> ,其中 <code>heights[row][col]</code> 表示格子 <code>(row, col)</code> 的高度。一开始你在最左上角的格子 <code>(0, 0)</code> ,且你希望去最右下角的格子 <code>(rows-1, columns-1)</code> (注意下标从 <strong>0</strong> 开始编号)。你每次可以往 <strong>上</strong>,<strong>下</strong>,<strong>左</strong>,<strong>右</strong> 四个方向之一移动,你想要找到耗费 <strong>体力</strong> 最小的一条路径。</p>\n\n<p>一条路径耗费的 <strong>体力值</strong> 是路径上相邻格子之间 <strong>高度差绝对值</strong> 的 <strong>最大值</strong> 决定的。</p>\n\n<p>请你返回从左上角走到右下角的最小<strong> 体力消耗值</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/10/25/ex1.png\" style=\"width: 300px; height: 300px;\" /></p>\n\n<pre>\n<b>输入:</b>heights = [[1,2,2],[3,8,2],[5,3,5]]\n<b>输出:</b>2\n<b>解释:</b>路径 [1,3,5,3,5] 连续格子的差值绝对值最大为 2 。\n这条路径比路径 [1,2,2,2,5] 更优,因为另一条路径差值最大值为 3 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/10/25/ex2.png\" style=\"width: 300px; height: 300px;\" /></p>\n\n<pre>\n<b>输入:</b>heights = [[1,2,3],[3,8,4],[5,3,5]]\n<b>输出:</b>1\n<b>解释:</b>路径 [1,2,3,4,5] 的相邻格子差值绝对值最大为 1 ,比路径 [1,3,5,3,5] 更优。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/10/25/ex3.png\" style=\"width: 300px; height: 300px;\" />\n<pre>\n<b>输入:</b>heights = [[1,2,1,1,1],[1,2,1,2,1],[1,2,1,2,1],[1,2,1,2,1],[1,1,1,2,1]]\n<b>输出:</b>0\n<b>解释:</b>上图所示路径不需要消耗任何体力。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>rows == heights.length</code></li>\n\t<li><code>columns == heights[i].length</code></li>\n\t<li><code>1 <= rows, columns <= 100</code></li>\n\t<li><code>1 <= heights[i][j] <= 10<sup>6</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 276,
|
||||
"likes": 282,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -173,7 +173,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"30K\", \"totalSubmission\": \"60.2K\", \"totalAcceptedRaw\": 29964, \"totalSubmissionRaw\": 60172, \"acRate\": \"49.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"30.9K\", \"totalSubmission\": \"62K\", \"totalAcceptedRaw\": 30891, \"totalSubmissionRaw\": 61951, \"acRate\": \"49.9%\"}",
|
||||
"hints": [
|
||||
"Consider the grid as a graph, where adjacent cells have an edge with cost of the difference between the cells.",
|
||||
"If you are given threshold k, check if it is possible to go from (0, 0) to (n-1, m-1) using only edges of ≤ k cost.",
|
||||
|
||||
Reference in New Issue
Block a user