1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 22:13:28 +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>coins</code> ,它代表你拥有的 <code>n</code> 个硬币。第 <code>i</code> 个硬币的值为 <code>coins[i]</code> 。如果你从这些硬币中选出一部分硬币,它们的和为 <code>x</code> ,那么称,你可以 <strong>构造</strong> 出 <code>x</code> 。</p>\n\n<p>请返回从 <code>0</code> 开始(<strong>包括</strong> <code>0</code> ),你最多能 <strong>构造</strong> 出多少个连续整数。</p>\n\n<p>你可能有多个相同值的硬币。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<b>输入:</b>coins = [1,3]\n<b>输出:</b>2\n<strong>解释:</strong>你可以得到以下这些值:\n- 0什么都不取 []\n- 1取 [1]\n从 0 开始,你可以构造出 2 个连续整数。</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<b>输入:</b>coins = [1,1,1,4]\n<b>输出:</b>8\n<strong>解释:</strong>你可以得到以下这些值:\n- 0什么都不取 []\n- 1取 [1]\n- 2取 [1,1]\n- 3取 [1,1,1]\n- 4取 [4]\n- 5取 [4,1]\n- 6取 [4,1,1]\n- 7取 [4,1,1,1]\n从 0 开始,你可以构造出 8 个连续整数。</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<b>输入:</b>nums = [1,4,10,3,1]\n<b>输出:</b>20</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>coins.length == n</code></li>\n\t<li><code>1 <= n <= 4 * 10<sup>4</sup></code></li>\n\t<li><code>1 <= coins[i] <= 4 * 10<sup>4</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 43,
"likes": 44,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"3.6K\", \"totalSubmission\": \"6.8K\", \"totalAcceptedRaw\": 3624, \"totalSubmissionRaw\": 6782, \"acRate\": \"53.4%\"}",
"stats": "{\"totalAccepted\": \"3.7K\", \"totalSubmission\": \"7K\", \"totalAcceptedRaw\": 3747, \"totalSubmissionRaw\": 7003, \"acRate\": \"53.5%\"}",
"hints": [
"Let's note that if you can make the first x values then you can and you have a value v≤x+1 then you can make all values ≤v+x",
"The smaller v is the smaller the x you need so it's optimal to process elements in a sorted order"