1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-18 19:46:47 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

更新国内版力扣题目描述变更

This commit is contained in:
2022-05-02 23:42:43 +08:00
parent 74598d1cf8
commit 7ea03594b3
198 changed files with 11378 additions and 11118 deletions

View File

@@ -1,28 +1,28 @@
<p>Design a method to find the frequency of occurrences of any given word in a book. What if we were running this algorithm multiple times?</p>
<p>You should implement following methods:</p>
<ul>
<li><code>WordsFrequency(book)</code> constructor, parameter is a array of strings, representing the book.</li>
<li><code>get(word)</code>&nbsp;get the frequency of <code>word</code> in the book.&nbsp;</li>
</ul>
<p><strong>Example: </strong></p>
<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;});
wordsFrequency.get(&quot;you&quot;); //returns 0&quot;you&quot; is not in the book
wordsFrequency.get(&quot;have&quot;); //returns 2&quot;have&quot; occurs twice in the book
wordsFrequency.get(&quot;an&quot;); //returns 1
wordsFrequency.get(&quot;apple&quot;); //returns 1
wordsFrequency.get(&quot;pen&quot;); //returns 1
</pre>
<p><strong>Note: </strong></p>
<ul>
<li><code>There are only lowercase letters in book[i].</code></li>
<li><code>1 &lt;= book.length &lt;= 100000</code></li>
<li><code>1 &lt;= book[i].length &lt;= 10</code></li>
<li><code>get</code>&nbsp;function will not be called more than&nbsp;100000 times.</li>
</ul>
<p>Design a method to find the frequency of occurrences of any given word in a book. What if we were running this algorithm multiple times?</p>
<p>You should implement following methods:</p>
<ul>
<li><code>WordsFrequency(book)</code> constructor, parameter is a array of strings, representing the book.</li>
<li><code>get(word)</code>&nbsp;get the frequency of <code>word</code> in the book.&nbsp;</li>
</ul>
<p><strong>Example: </strong></p>
<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;});
wordsFrequency.get(&quot;you&quot;); //returns 0&quot;you&quot; is not in the book