mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>元素的 <strong>频数</strong> 是该元素在一个数组中出现的次数。</p>\n\n<p>给你一个整数数组 <code>nums</code> 和一个整数 <code>k</code> 。在一步操作中,你可以选择 <code>nums</code> 的一个下标,并将该下标对应元素的值增加 <code>1</code> 。</p>\n\n<p>执行最多 <code>k</code> 次操作后,返回数组中最高频元素的 <strong>最大可能频数</strong> <em>。</em></p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,4], k = 5\n<strong>输出:</strong>3<strong>\n解释:</strong>对第一个元素执行 3 次递增操作,对第二个元素执 2 次递增操作,此时 nums = [4,4,4] 。\n4 是数组中最高频元素,频数是 3 。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,4,8,13], k = 5\n<strong>输出:</strong>2\n<strong>解释:</strong>存在多种最优解决方案:\n- 对第一个元素执行 3 次递增操作,此时 nums = [4,4,8,13] 。4 是数组中最高频元素,频数是 2 。\n- 对第二个元素执行 4 次递增操作,此时 nums = [1,8,8,13] 。8 是数组中最高频元素,频数是 2 。\n- 对第三个元素执行 5 次递增操作,此时 nums = [1,4,13,13] 。13 是数组中最高频元素,频数是 2 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [3,9,6], k = 2\n<strong>输出:</strong>1\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] <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= k <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 209,
|
||||
"likes": 215,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"31.2K\", \"totalSubmission\": \"72.9K\", \"totalAcceptedRaw\": 31210, \"totalSubmissionRaw\": 72937, \"acRate\": \"42.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"31.7K\", \"totalSubmission\": \"74.1K\", \"totalAcceptedRaw\": 31728, \"totalSubmissionRaw\": 74106, \"acRate\": \"42.8%\"}",
|
||||
"hints": [
|
||||
"Note that you can try all values in a brute force manner and find the maximum frequency of that value.",
|
||||
"To find the maximum frequency of a value consider the biggest elements smaller than or equal to this value"
|
||||
|
Reference in New Issue
Block a user