mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
22 lines
705 B
HTML
22 lines
705 B
HTML
<p>Write a method to sort an array of strings so that all the anagrams are in the same group.</p>
|
|
|
|
|
|
|
|
<p><b>Note: </b>This problem is slightly different from the original one the book.</p>
|
|
|
|
|
|
|
|
<p><strong>Example:</strong></p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
<strong>Input:</strong> <code>["eat", "tea", "tan", "ate", "nat", "bat"]</code>,
|
|
|
|
<strong>Output:</strong>
|
|
|
|
[
|
|
|
|
["ate","eat","tea"],
|
|
|
|
["nat","tan"],
|
|
|
|
["bat"]
|
|
|
|
]</pre>
|
|
|
|
|
|
|
|
<p><strong>Notes: </strong></p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>All inputs will be in lowercase.</li>
|
|
|
|
<li>The order of your output does not matter.</li>
|
|
|
|
</ul>
|
|
|