1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 23:41:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2023-12-09 19:57:46 +08:00
parent 9bc4722a45
commit 3770b44d1e
4792 changed files with 10889 additions and 10886 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": 213,
"likes": 214,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"23.5K\", \"totalSubmission\": \"33.1K\", \"totalAcceptedRaw\": 23541, \"totalSubmissionRaw\": 33125, \"acRate\": \"71.1%\"}",
"stats": "{\"totalAccepted\": \"23.5K\", \"totalSubmission\": \"33.1K\", \"totalAcceptedRaw\": 23545, \"totalSubmissionRaw\": 33136, \"acRate\": \"71.1%\"}",
"hints": [
"If you can make the first x values and you have a value v, then you can make all the values <var>≤ v + x</var>",
"Sort the array of coins. You can always make the value 0 so you can start with x = 0.",