mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 15:31:43 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个单词列表 <code>words</code> 和一个整数 <code>k</code> ,返回前 <code>k</code><em> </em>个出现次数最多的单词。</p>\n\n<p>返回的答案应该按单词出现频率由高到低排序。如果不同的单词有相同出现频率, <strong>按字典顺序</strong> 排序。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> words = [\"i\", \"love\", \"leetcode\", \"i\", \"love\", \"coding\"], k = 2\n<strong>输出:</strong> [\"i\", \"love\"]\n<strong>解析:</strong> \"i\" 和 \"love\" 为出现次数最多的两个单词,均为2次。\n 注意,按字母顺序 \"i\" 在 \"love\" 之前。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> [\"the\", \"day\", \"is\", \"sunny\", \"the\", \"the\", \"the\", \"sunny\", \"is\", \"is\"], k = 4\n<strong>输出:</strong> [\"the\", \"is\", \"sunny\", \"day\"]\n<strong>解析:</strong> \"the\", \"is\", \"sunny\" 和 \"day\" 是出现次数最多的四个单词,\n 出现次数依次为 4, 3, 2 和 1 次。\n</pre>\n\n<p> </p>\n\n<p><strong>注意:</strong></p>\n\n<ul>\n\t<li><code>1 <= words.length <= 500</code></li>\n\t<li><code>1 <= words[i] <= 10</code></li>\n\t<li><code>words[i]</code> 由小写英文字母组成。</li>\n\t<li><code>k</code> 的取值范围是 <code>[1, <strong>不同</strong> words[i] 的数量]</code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong>尝试以 <code>O(n log k)</code> 时间复杂度和 <code>O(n)</code> 空间复杂度解决。</p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 439,
|
||||
"likes": 447,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Top K Frequent Elements\", \"titleSlug\": \"top-k-frequent-elements\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u524d K \\u4e2a\\u9ad8\\u9891\\u5143\\u7d20\"}, {\"title\": \"K Closest Points to Origin\", \"titleSlug\": \"k-closest-points-to-origin\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6700\\u63a5\\u8fd1\\u539f\\u70b9\\u7684 K \\u4e2a\\u70b9\"}]",
|
||||
@@ -173,11 +173,11 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"77.6K\", \"totalSubmission\": \"136K\", \"totalAcceptedRaw\": 77623, \"totalSubmissionRaw\": 136034, \"acRate\": \"57.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"79.9K\", \"totalSubmission\": \"140.2K\", \"totalAcceptedRaw\": 79874, \"totalSubmissionRaw\": 140208, \"acRate\": \"57.0%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "[\"i\",\"love\",\"leetcode\",\"i\",\"love\",\"coding\"]\n2",
|
||||
"sampleTestCase": "[\"i\", \"love\", \"leetcode\", \"i\", \"love\", \"coding\"]\n2",
|
||||
"metaData": "{\r\n \"name\": \"topKFrequent\",\r\n \"params\": [\r\n {\r\n \"name\": \"words\",\r\n \"type\": \"string[]\"\r\n },\r\n {\r\n \"name\": \"k\",\r\n \"type\": \"integer\"\r\n }\r\n ],\r\n \"return\": {\r\n \"type\": \"list<string>\"\r\n }\r\n}\r\n",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
|
Reference in New Issue
Block a user