mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part2
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<p>You have a large text file containing words. Given any two words, find the shortest distance (in terms of number of words) between them in the file. If the operation will be repeated many times for the same file (but different pairs of words), can you optimize your solution?</p>
|
||||
|
||||
<p><strong>Example: </strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input: </strong>words = ["I","am","a","student","from","a","university","in","a","city"], word1 = "a", word2 = "student"
|
||||
<strong>Output: </strong>1</pre>
|
||||
|
||||
<p>Note:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>words.length <= 100000</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user