1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-13 01:15:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/数组中的字符串匹配 [string-matching-in-an-array].html
2025-09-29 14:43:44 +08:00

39 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个字符串数组 <code>words</code> ,数组中的每个字符串都可以看作是一个单词。请你按 <strong>任意</strong> 顺序返回 <code>words</code> 中是其他单词的 <span data-keyword="substring-nonempty">子字符串</span> 的所有单词。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<pre>
<strong>输入:</strong>words = ["mass","as","hero","superhero"]
<strong>输出:</strong>["as","hero"]
<strong>解释:</strong>"as" 是 "mass" 的子字符串,"hero" 是 "superhero" 的子字符串。
["hero","as"] 也是有效的答案。
</pre>
<p><strong class="example">示例 2</strong></p>
<pre>
<strong>输入:</strong>words = ["leetcode","et","code"]
<strong>输出:</strong>["et","code"]
<strong>解释:</strong>"et" 和 "code" 都是 "leetcode" 的子字符串。
</pre>
<p><strong class="example">示例 3</strong></p>
<pre>
<strong>输入:</strong>words = ["blue","green","bu"]
<strong>输出:</strong>[]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= words.length &lt;= 100</code></li>
<li><code>1 &lt;= words[i].length &lt;= 30</code></li>
<li><code>words[i]</code> 仅包含小写英文字母。</li>
<li>题目数据 <strong>保证</strong> <code>words</code>&nbsp;的每个字符串都是独一无二的。</li>
</ul>