Group anagrams
Given a list of strings, group together all strings that are anagrams of each other (identical letters, any order).
words = ["eat", "tea", "tan", "ate", "nat", "bat"]
-> [["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]
Return the groups (any order within and across groups). Aim for better than the all-pairs comparison.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.