Group Anagrams
Given a list of strings, group the ones that are anagrams of each other. An anagram is a rearrangement of the same letters. Return the groups in any order.
Examples
Input: ["eat","tea","tan","ate","nat","bat"]
Output: [["eat","tea","ate"], ["tan","nat"], ["bat"]]
Input: [""]
Output: [[""]]
Constraints
1 <= len(strs) <= 10^40 <= len(strs[i]) <= 100, lowercase English letters.
Solution
Full worked solution, code, and complexity analysis available in the interactive view.
Related problems
Reverse String
Easy
Contains Duplicate
Easy
Maximum Subarray
Medium
Product of Array Except Self
Medium