The problem. Given an array of lowercase strings strs, group the words that are anagrams of each other. Return the groups in any order.
strs = ["eat","tea","tan","ate","nat","bat"]
-> [["eat","tea","ate"], ["tan","nat"], ["bat"]]
strs = [""] -> [[""]]
strs = ["a"] -> [["a"]]Members only · free account
The rest of this lesson, with 6 more sections, 1 drawing, a dry-run simulator and code in JavaScript, Python, Java and C++, opens with a free account.
Not ready yet? The Arrays course is free to read, no account needed.
In the rest of this lesson