mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 07:21:40 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code>,每次 <strong>操作</strong> 会从中选择一个元素并 <strong>将该元素的值减少 1</strong>。</p>\n\n<p>如果符合下列情况之一,则数组 <code>A</code> 就是 <strong>锯齿数组</strong>:</p>\n\n<ul>\n\t<li>每个偶数索引对应的元素都大于相邻的元素,即 <code>A[0] > A[1] < A[2] > A[3] < A[4] > ...</code></li>\n\t<li>或者,每个奇数索引对应的元素都大于相邻的元素,即 <code>A[0] < A[1] > A[2] < A[3] > A[4] < ...</code></li>\n</ul>\n\n<p>返回将数组 <code>nums</code> 转换为锯齿数组所需的最小操作次数。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,2,3]\n<strong>输出:</strong>2\n<strong>解释:</strong>我们可以把 2 递减到 0,或把 3 递减到 1。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>nums = [9,6,1,6,2]\n<strong>输出:</strong>4\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 1000</code></li>\n\t<li><code>1 <= nums[i] <= 1000</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 38,
|
||||
"likes": 39,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"11K\", \"totalSubmission\": \"24.8K\", \"totalAcceptedRaw\": 11000, \"totalSubmissionRaw\": 24753, \"acRate\": \"44.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"11.1K\", \"totalSubmission\": \"25K\", \"totalAcceptedRaw\": 11126, \"totalSubmissionRaw\": 25013, \"acRate\": \"44.5%\"}",
|
||||
"hints": [
|
||||
"Do each case (even indexed is greater, odd indexed is greater) separately. In say the even case, you should decrease each even-indexed element until it is lower than its immediate neighbors."
|
||||
],
|
||||
|
Reference in New Issue
Block a user