We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eb177e6 commit 92240cdCopy full SHA for 92240cd
group-anagrams/printjin-gmailcom.py
@@ -0,0 +1,9 @@
1
+from collections import defaultdict
2
+
3
+class Solution:
4
+ def groupAnagrams(self, strs):
5
+ anagrams = defaultdict(list)
6
+ for word in strs:
7
+ key = ''.join(sorted(word))
8
+ anagrams[key].append(word)
9
+ return list(anagrams.values())
0 commit comments