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 183f9b1 commit 488a909Copy full SHA for 488a909
group-anagrams/WhiteHyun.swift
@@ -0,0 +1,18 @@
1
+//
2
+// 49. Group Anagrams
3
+// https://leetcode.com/problems/group-anagrams/description/
4
+// Dale-Study
5
6
+// Created by WhiteHyun on 2024/05/19.
7
8
+
9
+final class Solution {
10
+ func groupAnagrams(_ strs: [String]) -> [[String]] {
11
+ var dictionary: [String: [String]] = [:]
12
+ for str in strs {
13
+ dictionary[String(str.sorted()), default: []].append(str)
14
+ }
15
16
+ return Array(dictionary.values)
17
18
+}
0 commit comments