1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/查找包含给定字符的单词 [find-words-containing-character].html
2023-12-09 01:16:38 +08:00

43 lines
1.5 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>给你一个下标从 <strong>0</strong>&nbsp;开始的字符串数组&nbsp;<code>words</code>&nbsp;和一个字符&nbsp;<code>x</code>&nbsp;</p>
<p>请你返回一个 <strong>下标数组</strong>&nbsp;,表示下标在数组中对应的单词包含字符 <code>x</code>&nbsp;</p>
<p><b>注意</b>&nbsp;,返回的数组可以是&nbsp;<strong>任意</strong>&nbsp;顺序。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<pre>
<b>输入:</b>words = ["leet","code"], x = "e"
<b>输出:</b>[0,1]
<b>解释:</b>"e" 在两个单词中都出现了:"l<em><strong>ee</strong></em>t" 和 "cod<em><strong>e</strong></em>" 。所以我们返回下标 0 和 1 。
</pre>
<p><strong class="example">示例 2</strong></p>
<pre>
<b>输入:</b>words = ["abc","bcd","aaaa","cbc"], x = "a"
<b>输出:</b>[0,2]
<b>解释:</b>"a" 在 "<em><strong>a</strong></em>bc" 和 "<em><strong>aaaa</strong></em>" 中出现了,所以我们返回下标 0 和 2 。
</pre>
<p><strong class="example">示例 3</strong></p>
<pre>
<b>输入:</b>words = ["abc","bcd","aaaa","cbc"], x = "z"
<b>输出:</b>[]
<b>解释:</b>"z" 没有在任何单词中出现。所以我们返回空数组。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= words.length &lt;= 50</code></li>
<li><code>1 &lt;= words[i].length &lt;= 50</code></li>
<li><code>x</code>&nbsp;是一个小写英文字母。</li>
<li><code>words[i]</code>&nbsp;只包含小写英文字母。</li>
</ul>