Given an array of strings strs, group the anagrams together. Return the groups as a list of lists.
Use a hash map keyed by a canonical signature for each string — either the sorted characters or a tuple of 26 character counts. Strings sharing a signature land in the same bucket.
The ordering of groups in the result and the ordering of strings within a group does not matter.
Example: strs = ["eat","tea","tan","ate","nat","bat"] → [["eat","tea","ate"],["tan","nat"],["bat"]].
[["eat","tea","ate"],["tan","nat"],["bat"]]