Group Anagrams
Medium
LC #49
hash mapcanonical keystringNot attempted yet
Given a list of strings strs, group together the words
that are anagrams of each other (same letters, same
counts). Return the groups in any order; the words inside a
group can be in any order too.
Example 1
Input: strs = ["pot", "top", "tap", "opt", "pat", "cat"]
Output: [["pot", "top", "opt"], ["tap", "pat"], ["cat"]]
Example 2
Input: strs = [""]
Output: [[""]]
Example 3
Input: strs = ["a"]
Output: [["a"]]
Constraints
- 1 ≤ len(strs) ≤ 2 · 10^4
- 0 ≤ len(strs[i]) ≤ 100
- Lowercase English letters only