← 返回 amazon 的题目列表Group Anagrams from String Array
类型:online_judge
amazon
Given a string array, write a function to group the strings so that the strings in the same group are anagrams. Return all the groups. Example: Input: ['eat', 'tea', 'tan', 'ate', 'nat', 'bat'] Output: [['eat', 'tea', 'ate'], ['tan', 'nat'], ['bat']]. Constraints: The number of strings does not exceed 10^3, and the length of each string does not exceed 100.
Example
Input
['eat', 'tea', 'tan', 'ate', 'nat', 'bat']