mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-13 01:15:14 +08:00
46 lines
1.4 KiB
HTML
46 lines
1.4 KiB
HTML
<p>给你一个字符串数组,请你将 <span data-keyword="anagram">字母异位词</span> 组合在一起。可以按任意顺序返回结果列表。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><strong>输入:</strong> strs = ["eat", "tea", "tan", "ate", "nat", "bat"]</p>
|
||
|
||
<p><strong>输出: </strong>[["bat"],["nat","tan"],["ate","eat","tea"]]</p>
|
||
|
||
<p><strong>解释:</strong></p>
|
||
|
||
<ul>
|
||
<li>在 strs 中没有字符串可以通过重新排列来形成 <code>"bat"</code>。</li>
|
||
<li>字符串 <code>"nat"</code> 和 <code>"tan"</code> 是字母异位词,因为它们可以重新排列以形成彼此。</li>
|
||
<li>字符串 <code>"ate"</code> ,<code>"eat"</code> 和 <code>"tea"</code> 是字母异位词,因为它们可以重新排列以形成彼此。</li>
|
||
</ul>
|
||
</div>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><strong>输入:</strong> strs = [""]</p>
|
||
|
||
<p><strong>输出: </strong>[[""]]</p>
|
||
</div>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><strong>输入:</strong> strs = ["a"]</p>
|
||
|
||
<p><strong>输出: </strong>[["a"]]</p>
|
||
</div>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= strs.length <= 10<sup>4</sup></code></li>
|
||
<li><code>0 <= strs[i].length <= 100</code></li>
|
||
<li><code>strs[i]</code> 仅包含小写字母</li>
|
||
</ul>
|