--Stay hungry, stay foolish.
--Forever young, forever weep.
Given an array of strings, group anagrams together.
Example:
Input:
["eat", "tea", "tan", "ate", "nat", "bat"]
Output:
[
["ate","eat","tea"],
["nat","tan"],
["bat"]
]
Note:
class Solution: def groupAnagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ words = dict() for s in strs: tp_s = ''.join(sorted(s)) words.setdefault(tp_s, []).append(s) return [s for s in words.values()]