Group words that are anagrams of each other (same letters, same counts). Sort the words inside each group alphabetically, and sort the groups by their first word.
Implement group_anagrams. Input: words: list[str]. Returns: list[list[str]].
def group_anagrams(words: list[str]) -> list[list[str]]:
return [[w] for w in words]
Run executes the public tests. Submit grades against public and hidden tests.
Group words that are anagrams of each other (same letters, same counts). Sort the words inside each group alphabetically, and sort the groups by their first word.
Implement group_anagrams. Input: words: list[str]. Returns: list[list[str]].
def group_anagrams(words: list[str]) -> list[list[str]]:
return [[w] for w in words]
Run executes the public tests. Submit grades against public and hidden tests.