mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-24 06:18:57 +08:00
update
This commit is contained in:
@@ -12,13 +12,19 @@
|
||||
"translatedContent": "<p>给你一个下标从 <strong>0</strong> 开始的整数数组 <code>nums</code> ,如果满足下述条件,则认为数组 <code>nums</code> 是一个 <strong>美丽数组</strong> :</p>\n\n<ul>\n\t<li><code>nums.length</code> 为偶数</li>\n\t<li>对所有满足 <code>i % 2 == 0</code> 的下标 <code>i</code> ,<code>nums[i] != nums[i + 1]</code> 均成立</li>\n</ul>\n\n<p>注意,空数组同样认为是美丽数组。</p>\n\n<p>你可以从 <code>nums</code> 中删除任意数量的元素。当你删除一个元素时,被删除元素右侧的所有元素将会向左移动一个单位以填补空缺,而左侧的元素将会保持 <strong>不变</strong> 。</p>\n\n<p>返回使 <code>nums</code> 变为美丽数组所需删除的 <strong>最少</strong> 元素数目<em>。</em></p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,1,2,3,5]\n<strong>输出:</strong>1\n<strong>解释:</strong>可以删除 <code>nums[0]</code> 或 <code>nums[1]</code> ,这样得到的 <code>nums</code> = [1,2,3,5] 是一个美丽数组。可以证明,要想使 nums 变为美丽数组,至少需要删除 1 个元素。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,1,2,2,3,3]\n<strong>输出:</strong>2\n<strong>解释:</strong>可以删除 <code>nums[0]</code> 和 <code>nums[5]</code> ,这样得到的 nums = [1,2,2,3] 是一个美丽数组。可以证明,要想使 nums 变为美丽数组,至少需要删除 2 个元素。\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>0 <= nums[i] <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 15,
|
||||
"likes": 19,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": "{\"cpp\": true, \"java\": true, \"python\": true, \"python3\": true, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"ruby\": false, \"bash\": false, \"swift\": false, \"golang\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"kotlin\": false, \"rust\": false, \"php\": false, \"typescript\": false, \"racket\": false, \"erlang\": false, \"elixir\": false}",
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Stack",
|
||||
"slug": "stack",
|
||||
"translatedName": "栈",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Greedy",
|
||||
"slug": "greedy",
|
||||
@@ -26,9 +32,9 @@
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Dynamic Programming",
|
||||
"slug": "dynamic-programming",
|
||||
"translatedName": "动态规划",
|
||||
"name": "Array",
|
||||
"slug": "array",
|
||||
"translatedName": "数组",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
@@ -143,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.6K\", \"totalSubmission\": \"14.5K\", \"totalAcceptedRaw\": 6606, \"totalSubmissionRaw\": 14539, \"acRate\": \"45.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.7K\", \"totalSubmission\": \"16.4K\", \"totalAcceptedRaw\": 7683, \"totalSubmissionRaw\": 16420, \"acRate\": \"46.8%\"}",
|
||||
"hints": [
|
||||
"Delete as many adjacent equal elements as necessary.",
|
||||
"If the length of nums is odd after the entire process, delete the last element."
|
||||
|
||||
Reference in New Issue
Block a user