1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 21:46:46 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个由 <code>n</code> 个正整数组成的数组 <code>nums</code> 。</p>\n\n<p>你可以对数组的任意元素执行任意次数的两类操作:</p>\n\n<ul>\n\t<li>如果元素是<strong> 偶数</strong> <strong>除以</strong> <code>2</code>\n\n\t<ul>\n\t\t<li>例如,如果数组是 <code>[1,2,3,4]</code> ,那么你可以对最后一个元素执行此操作,使其变成 <code>[1,2,3,<strong>2</strong>]</code></li>\n\t</ul>\n\t</li>\n\t<li>如果元素是 <strong>奇数</strong> <strong>乘上</strong> <code>2</code>\n\t<ul>\n\t\t<li>例如,如果数组是 <code>[1,2,3,4]</code> ,那么你可以对第一个元素执行此操作,使其变成 <code>[<strong>2</strong>,2,3,4]</code></li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>数组的 <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><strong>输入:</strong>nums = [1,2,3,4]\n<strong>输出:</strong>1\n<strong>解释:</strong>你可以将数组转换为 [1,2,3,<strong>2</strong>],然后转换成 [<strong>2</strong>,2,3,2],偏移量是 3 - 2 = 1\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>nums = [4,1,5,20,3]\n<strong>输出:</strong>3\n<strong>解释:</strong>两次操作后,你可以将数组转换为 [4,<strong>2</strong>,5,<strong>5</strong>,3],偏移量是 5 - 2 = 3\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>nums = [2,10,8]\n<strong>输出:</strong>3\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == nums.length</code></li>\n\t<li><code>2 &lt;= n &lt;= 10<sup><span style=\"\">5</span></sup></code></li>\n\t<li><code>1 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 59,
"likes": 61,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"3.2K\", \"totalSubmission\": \"7.3K\", \"totalAcceptedRaw\": 3160, \"totalSubmissionRaw\": 7345, \"acRate\": \"43.0%\"}",
"stats": "{\"totalAccepted\": \"3.3K\", \"totalSubmission\": \"7.6K\", \"totalAcceptedRaw\": 3263, \"totalSubmissionRaw\": 7566, \"acRate\": \"43.1%\"}",
"hints": [
"Assume you start with the minimum possible value for each number so you can only multiply a number by 2 till it reaches its maximum possible value.",
"If there is a better solution than the current one, then it must have either its maximum value less than the current maximum value, or the minimum value larger than the current minimum value.",