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 7c25530 commit 448c105Copy full SHA for 448c105
group-anagrams/8804who.py
@@ -0,0 +1,8 @@
1
+class Solution:
2
+ def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
3
+ dic=defaultdict(list)
4
+ for string in strs:
5
+ sorted_str = ''.join(sorted(string))
6
+ dic[sorted_str].append(string)
7
+
8
+ return list(dic.values())
0 commit comments