Group Anagrams
Given an array of strings strs, group the anagrams together.
An anagram is a word or phrase formed by rearranging the letters of another word or phrase, using all original letters exactly once.
Return a list of groups, where each group contains strings from strs that are anagrams of one another. You may return the groups in any order, and the strings within each group may also be in any order.
Example 1
Input
strs = ["eat","tea","tan","ate","nat","bat"]Output
[["bat"],["nat","tan"],["ate","eat","tea"]]The strings "eat", "tea", and "ate" are anagrams, as are "tan" and "nat", while "bat" forms its own group.
Example 2
Input
strs = [""]Output
[[""]]The only string is the empty string, so it forms a single anagram group by itself.
Constraints
- 1 <= strs.length <= 10^4
- 0 <= strs[i].length <= 100
- strs[i] consists of lowercase English letters