mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
21 lines
980 B
HTML
21 lines
980 B
HTML
<p>Given a string band an array of smaller strings T, design a method to search b for each small string in T. Output <code>positions</code> of all strings in <code>smalls</code> that appear in <code>big</code>, where <code>positions[i]</code> is all positions of <code>smalls[i]</code>.</p>
|
|
|
|
|
|
|
|
<p><strong>Example: </strong></p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
<strong>Input: </strong>
|
|
|
|
big = "mississippi"
|
|
|
|
smalls = ["is","ppi","hi","sis","i","ssippi"]
|
|
|
|
<strong>Output: </strong> [[1,4],[8],[],[3],[1,4,7,10],[5]]
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p><strong>Note: </strong></p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li><code>0 <= len(big) <= 1000</code></li>
|
|
|
|
<li><code>0 <= len(smalls[i]) <= 1000</code></li>
|
|
|
|
<li>The total number of characters in <code>smalls</code> will not exceed 100000.</li>
|
|
|
|
<li>No duplicated strings in <code>smalls</code>.</li>
|
|
|
|
<li>All characters are lowercase letters.</li>
|
|
|
|
</ul>
|
|
|