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 fc48533 commit d81cc20Copy full SHA for d81cc20
group-anagrams/hu6r1s.py
@@ -0,0 +1,12 @@
1
+from collections import defaultdict
2
+
3
+class Solution:
4
+ """
5
+ 1. 정렬된 값이 딕셔너리에 있으면 리스트 형식으로 삽입
6
7
+ def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
8
+ dict_strs = defaultdict(list)
9
10
+ for word in strs:
11
+ dict_strs[str(sorted(word))].append(word)
12
+ return list(dict_strs.values())
0 commit comments