Group Anagrams
Group words made of the same letters by giving each word a key, its sorted letters, and collecting words by key in a map.
01The problem
Group the words in strs that are anagrams of each other (same letters, any order). Return the groups in any order.
| Input | Output |
|---|---|
["eat","tea","tan","ate","nat","bat"] | [["eat","tea","ate"],["tan","nat"],["bat"]] |
[""] | [[""]] |
Loading the rest of the lesson…