mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-12-17 17:52:34 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个下标从 <strong>0</strong> 开始的数组 <code>nums</code> ,数组由若干 <strong>互不相同</strong> 的整数组成。</p>\n\n<p><code>nums</code> 中有一个值最小的元素和一个值最大的元素。分别称为 <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<pre>\n<strong>输入:</strong>nums = [2,<em><strong>10</strong></em>,7,5,4,<em><strong>1</strong></em>,8,6]\n<strong>输出:</strong>5\n<strong>解释:</strong>\n数组中的最小元素是 nums[5] ,值为 1 。\n数组中的最大元素是 nums[1] ,值为 10 。\n将最大值和最小值都移除需要从数组前面移除 2 个元素,从数组后面移除 3 个元素。\n结果是 2 + 3 = 5 ,这是所有可能情况中的最小删除次数。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0,<em><strong>-4</strong></em>,<em><strong>19</strong></em>,1,8,-2,-3,5]\n<strong>输出:</strong>3\n<strong>解释:</strong>\n数组中的最小元素是 nums[1] ,值为 -4 。\n数组中的最大元素是 nums[2] ,值为 19 。\n将最大值和最小值都移除需要从数组前面移除 3 个元素。\n结果是 3 ,这是所有可能情况中的最小删除次数。 \n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [<em><strong>101</strong></em>]\n<strong>输出:</strong>1\n<strong>解释:</strong>\n数组中只有这一个元素,那么它既是数组中的最小值又是数组中的最大值。\n移除它只需要 1 次删除操作。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>-10<sup>5</sup> <= nums[i] <= 10<sup>5</sup></code></li>\n\t<li><code>nums</code> 中的整数 <strong>互不相同</strong></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 8,
|
||||
"likes": 9,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6K\", \"totalSubmission\": \"10.4K\", \"totalAcceptedRaw\": 5960, \"totalSubmissionRaw\": 10397, \"acRate\": \"57.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"6.3K\", \"totalSubmission\": \"11.1K\", \"totalAcceptedRaw\": 6295, \"totalSubmissionRaw\": 11088, \"acRate\": \"56.8%\"}",
|
||||
"hints": [
|
||||
"There can only be three scenarios for deletions such that both minimum and maximum elements are removed:",
|
||||
"Scenario 1: Both elements are removed by only deleting from the front.",
|
||||
|
||||
Reference in New Issue
Block a user