Two words are anagrams when one can be made from the other by changing the order of its letters, using every letter exactly once. For example, "stop" and "pots" are anagrams.
Given an array of strings strs, put the anagrams together in groups. Return the groups. You can return the groups in any order, and the words inside a group in any order.
Examples
Example 1:
Input: strs = ["listen","silent","enlist","google","gogole"]
Output: [["listen","silent","enlist"],["google","gogole"]]
Explanation: "listen", "silent" and "enlist" use the same letters. "google" and "gogole" use the same letters.
Example 2:
Input: strs = ["a","b","a"]
Output: [["a","a"],["b"]]
Explanation: Both "a" words go into one group. "b" is alone.
Example 3:
Input: strs = [""]
Output: [[""]]
Explanation: The empty string forms a group by itself.