mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 05:26:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>在一个长度 <strong>无限 </strong>的数轴上,第 <code>i</code> 颗石子的位置为 <code>stones[i]</code>。如果一颗石子的位置最小/最大,那么该石子被称作 <strong>端点石子 </strong>。</p>\n\n<p>每个回合,你可以将一颗端点石子拿起并移动到一个未占用的位置,使得该石子不再是一颗端点石子。</p>\n\n<p>值得注意的是,如果石子像 <code>stones = [1,2,5]</code> 这样,你将 <strong>无法 </strong>移动位于位置 5 的端点石子,因为无论将它移动到任何位置(例如 0 或 3),该石子都仍然会是端点石子。</p>\n\n<p>当你无法进行任何移动时,即,这些石子的位置连续时,游戏结束。</p>\n\n<p>要使游戏结束,你可以执行的最小和最大移动次数分别是多少? 以长度为 2 的数组形式返回答案:<code>answer = [minimum_moves, maximum_moves]</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>[7,4,9]\n<strong>输出:</strong>[1,2]\n<strong>解释:</strong>\n我们可以移动一次,4 -> 8,游戏结束。\n或者,我们可以移动两次 9 -> 5,4 -> 6,游戏结束。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>[6,5,4,3,10]\n<strong>输出:</strong>[2,3]\n<strong>解释:</strong>\n我们可以移动 3 -> 8,接着是 10 -> 7,游戏结束。\n或者,我们可以移动 3 -> 7, 4 -> 8, 5 -> 9,游戏结束。\n注意,我们无法进行 10 -> 2 这样的移动来结束游戏,因为这是不合要求的移动。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>[100,101,104,102,103]\n<strong>输出:</strong>[0,0]</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>3 <= stones.length <= 10^4</code></li>\n\t<li><code>1 <= stones[i] <= 10^9</code></li>\n\t<li><code>stones[i]</code> 的值各不相同。</li>\n</ul>\n\n<p> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 73,
|
||||
"likes": 74,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3K\", \"totalSubmission\": \"5.7K\", \"totalAcceptedRaw\": 2973, \"totalSubmissionRaw\": 5701, \"acRate\": \"52.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3K\", \"totalSubmission\": \"5.7K\", \"totalAcceptedRaw\": 2979, \"totalSubmissionRaw\": 5707, \"acRate\": \"52.2%\"}",
|
||||
"hints": [
|
||||
"For the minimum, how many cows are already in place?\r\nFor the maximum, we have to lose either the gap A[1] - A[0] or A[N-1] - A[N-2] (where N = A.length), but every other space can be occupied."
|
||||
],
|
||||
|
Reference in New Issue
Block a user