mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 13:06:47 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> (<strong>下标从 0 开始</strong>)。每一次操作中,你可以选择数组中一个元素,并将它增加 <code>1</code> 。</p>\n\n<ul>\n\t<li>比方说,如果 <code>nums = [1,2,3]</code> ,你可以选择增加 <code>nums[1]</code> 得到 <code>nums = [1,<b>3</b>,3]</code> 。</li>\n</ul>\n\n<p>请你返回使 <code>nums</code> <strong>严格递增</strong> 的 <strong>最少</strong> 操作次数。</p>\n\n<p>我们称数组 <code>nums</code> 是 <strong>严格递增的</strong> ,当它满足对于所有的 <code>0 <= i < nums.length - 1</code> 都有 <code>nums[i] < nums[i+1]</code> 。一个长度为 <code>1</code> 的数组是严格递增的一种特殊情况。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><b>输入:</b>nums = [1,1,1]\n<b>输出:</b>3\n<b>解释:</b>你可以进行如下操作:\n1) 增加 nums[2] ,数组变为 [1,1,<strong>2</strong>] 。\n2) 增加 nums[1] ,数组变为 [1,<strong>2</strong>,2] 。\n3) 增加 nums[2] ,数组变为 [1,2,<strong>3</strong>] 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><b>输入:</b>nums = [1,5,2,4,1]\n<b>输出:</b>14\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><b>输入:</b>nums = [8]\n<b>输出:</b>0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 5000</code></li>\n\t<li><code>1 <= nums[i] <= 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 22,
|
||||
"likes": 24,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"12.8K\", \"totalSubmission\": \"16.2K\", \"totalAcceptedRaw\": 12767, \"totalSubmissionRaw\": 16215, \"acRate\": \"78.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"13.4K\", \"totalSubmission\": \"17.1K\", \"totalAcceptedRaw\": 13446, \"totalSubmissionRaw\": 17090, \"acRate\": \"78.7%\"}",
|
||||
"hints": [
|
||||
"nums[i+1] must be at least equal to nums[i] + 1.",
|
||||
"Think greedily. You don't have to increase nums[i+1] beyond nums[i]+1.",
|
||||
|
Reference in New Issue
Block a user