mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-03 06:22:54 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> 和一个整数 <code>k</code> 。请你向 <code>nums</code> 中追加 <code>k</code> 个 <strong>未</strong> 出现在 <code>nums</code> 中的、<strong>互不相同</strong> 的 <strong>正</strong> 整数,并使结果数组的元素和 <strong>最小</strong> 。</p>\n\n<p>返回追加到 <code>nums</code> 中的 <code>k</code> 个整数之和。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,4,25,10,25], k = 2\n<strong>输出:</strong>5\n<strong>解释:</strong>在该解法中,向数组中追加的两个互不相同且未出现的正整数是 2 和 3 。\nnums 最终元素和为 1 + 4 + 25 + 10 + 25 + 2 + 3 = 70 ,这是所有情况中的最小值。\n所以追加到数组中的两个整数之和是 2 + 3 = 5 ,所以返回 5 。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>nums = [5,6], k = 6\n<strong>输出:</strong>25\n<strong>解释:</strong>在该解法中,向数组中追加的两个互不相同且未出现的正整数是 1 、2 、3 、4 、7 和 8 。\nnums 最终元素和为 5 + 6 + 1 + 2 + 3 + 4 + 7 + 8 = 36 ,这是所有情况中的最小值。\n所以追加到数组中的两个整数之和是 1 + 2 + 3 + 4 + 7 + 8 = 25 ,所以返回 25 。\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>1 <= nums[i], k <= 10<sup>9</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 29,
|
||||
"likes": 30,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.9K\", \"totalSubmission\": \"39.2K\", \"totalAcceptedRaw\": 8912, \"totalSubmissionRaw\": 39247, \"acRate\": \"22.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"9.2K\", \"totalSubmission\": \"40.4K\", \"totalAcceptedRaw\": 9231, \"totalSubmissionRaw\": 40361, \"acRate\": \"22.9%\"}",
|
||||
"hints": [
|
||||
"The k smallest numbers that do not appear in nums will result in the minimum sum.",
|
||||
"Recall that the sum of the first n positive numbers is equal to n * (n+1) / 2.",
|
||||
|
Reference in New Issue
Block a user