← All problems
Group Anagrams
Given an array of strings, group all anagrams together and return the groups in any order. Two strings are anagrams if one can be rearranged into the other. Optimize beyond pairwise comparison.
Complexity
Time O(n*k), Space O(n*k)
Common pitfalls
- Using the sorted string when k is huge
- Mutating the key
Your solution
Log in to save your code and track progress.