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 7fd29f2 commit 7963135Copy full SHA for 7963135
1 file changed
group-anagrams/yuseok89.py
@@ -0,0 +1,12 @@
1
+# TC: O(N * LlogL)
2
+# SC: O(N * L)
3
+class Solution:
4
+ def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
5
+
6
+ ans = defaultdict(list)
7
8
+ for s in strs:
9
+ ans[''.join(sorted(s))].append(s)
10
11
+ return list(ans.values())
12
0 commit comments