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>设计一个方法,找出任意指定单词在一本书中的出现频率。</p>\n\n<p>你的实现应该支持如下操作:</p>\n\n<ul>\n\t<li><code>WordsFrequency(book)</code>构造函数,参数为字符串数组构成的一本书</li>\n\t<li><code>get(word)</code>查询指定单词在书中出现的频率</li>\n</ul>\n\n<p><strong>示例:</strong></p>\n\n<pre>WordsFrequency wordsFrequency = new WordsFrequency({&quot;i&quot;, &quot;have&quot;, &quot;an&quot;, &quot;apple&quot;, &quot;he&quot;, &quot;have&quot;, &quot;a&quot;, &quot;pen&quot;});\nwordsFrequency.get(&quot;you&quot;); //返回0&quot;you&quot;没有出现过\nwordsFrequency.get(&quot;have&quot;); //返回2&quot;have&quot;出现2次\nwordsFrequency.get(&quot;an&quot;); //返回1\nwordsFrequency.get(&quot;apple&quot;); //返回1\nwordsFrequency.get(&quot;pen&quot;); //返回1\n</pre>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>book[i]</code>中只包含小写字母</li>\n\t<li><code>1 &lt;= book.length &lt;= 100000</code></li>\n\t<li><code>1 &lt;= book[i].length &lt;= 10</code></li>\n\t<li><code>get</code>函数的调用次数不会超过100000</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 31,
"likes": 34,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"18K\", \"totalSubmission\": \"23.4K\", \"totalAcceptedRaw\": 18007, \"totalSubmissionRaw\": 23438, \"acRate\": \"76.8%\"}",
"stats": "{\"totalAccepted\": \"18.5K\", \"totalSubmission\": \"24.1K\", \"totalAcceptedRaw\": 18505, \"totalSubmissionRaw\": 24109, \"acRate\": \"76.8%\"}",
"hints": [
"想想这个问题的最佳运行时间是多少。如果你的解法匹配最理想的运行时间,那么你可能无法做的更好了。",
"可以使用散列表来优化重复的情况吗?"