Arrays & HashingMedium

Group Anagrams

Put words that are anagrams of each other into the same group and return the groups. Groups, and words inside a group, can be in any order.

Example 1words = ["tea", "bat", "eat", "tab", "zen"] → [["tea", "eat"], ["bat", "tab"], ["zen"]]
Example 2words = [""] → [[""]]
1 ≤ words ≤ 10⁴ · each word ≤ 100 lowercase letters

Hints

0 of 3 open
Hint 2 · the patternHint 3 · the key line