Group the words that are anagrams of each other (they use exactly the same letters). Inside a group sort the words alphabetically (repeated words stay), and sort the groups by their first word. Return the list of groups.
Example 1
Input:
group_anagrams(['eat', 'tea', 'tan', 'ate', 'nat', 'bat'])
Output:
[['ate', 'eat', 'tea'], ['bat'], ['nat', 'tan']]
Example 2
Input:
group_anagrams(['a'])
Output:
[['a']]
0 <= len(words) <= 10**5No results yet
Run your code to check it against the examples, or submit to run every test.