In a Meta text-processing pipeline for Feed ranking features, you are given a list of lowercase strings. Group all strings that are anagrams of each other and return the groups.
Two strings are anagrams if they contain the same characters with the same frequencies, possibly in a different order.
Implement a function that takes strs, a list of strings, and returns a list of groups, where each group is a list of strings that are mutual anagrams.
strs: List[str]List[List[str]]The order of groups does not matter. The order of strings within each group does not matter.
Example 1
strs = ["eat", "tea", "tan", "ate", "nat", "bat"][["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]Example 2
strs = [""][[""]]1 <= len(strs) <= 10^40 <= len(strs[i]) <= 100strs[i] contains only lowercase English letters