1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 07:21:40 +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>Alice 有 <code>n</code> 枚糖,其中第 <code>i</code> 枚糖的类型为 <code>candyType[i]</code> 。Alice 注意到她的体重正在增长,所以前去拜访了一位医生。</p>\n\n<p>医生建议 Alice 要少摄入糖分,只吃掉她所有糖的 <code>n / 2</code> 即可(<code>n</code> 是一个偶数。Alice 非常喜欢这些糖,她想要在遵循医生建议的情况下,尽可能吃到最多不同种类的糖。</p>\n\n<p>给你一个长度为 <code>n</code> 的整数数组 <code>candyType</code> ,返回: Alice <em>在仅吃掉 <code>n / 2</code> 枚糖的情况下,可以吃到糖的 <strong>最多</strong> 种类数</em>。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>candyType = [1,1,2,2,3,3]\n<strong>输出:</strong>3\n<strong>解释:</strong>Alice 只能吃 6 / 2 = 3 枚糖,由于只有 3 种糖,她可以每种吃一枚。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>candyType = [1,1,2,3]\n<strong>输出:</strong>2\n<strong>解释:</strong>Alice 只能吃 4 / 2 = 2 枚糖,不管她选择吃的种类是 [1,2]、[1,3] 还是 [2,3],她只能吃到两种不同类的糖。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>candyType = [6,6,6,6]\n<strong>输出:</strong>1\n<strong>解释:</strong>Alice 只能吃 4 / 2 = 2 枚糖,尽管她能吃 2 枚,但只能吃到 1 种糖。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == candyType.length</code></li>\n\t<li><code>2 &lt;= n &lt;= 10<sup>4</sup></code></li>\n\t<li><code>n</code> 是一个偶数</li>\n\t<li><code>-10<sup>5</sup> &lt;= candyType[i] &lt;= 10<sup>5</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 200,
"likes": 204,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"92.2K\", \"totalSubmission\": \"129.8K\", \"totalAcceptedRaw\": 92190, \"totalSubmissionRaw\": 129786, \"acRate\": \"71.0%\"}",
"stats": "{\"totalAccepted\": \"94.2K\", \"totalSubmission\": \"132.7K\", \"totalAcceptedRaw\": 94214, \"totalSubmissionRaw\": 132718, \"acRate\": \"71.0%\"}",
"hints": [
"To maximize the number of kinds of candies, we should try to distribute candies such that sister will gain all kinds.",
"What is the upper limit of the number of kinds of candies sister will gain? Remember candies are to distributed equally.",