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 136a246 commit 38f42a2Copy full SHA for 38f42a2
group-anagrams/kayden.py
@@ -0,0 +1,10 @@
1
+# 시간복잡도: O(N)
2
+# 공간복잡도: O(N)
3
+class Solution:
4
+ def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
5
+ groups = {}
6
+ for anagram in strs:
7
+ key = str(sorted(anagram))
8
+ groups.setdefault(key, []).append(anagram)
9
+
10
+ return list(groups.values())
0 commit comments