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 c1b622b commit 3af8518Copy full SHA for 3af8518
group-anagrams/sonjh1217.swift
@@ -2,7 +2,7 @@ class Solution {
2
func groupAnagrams(_ strs: [String]) -> [[String]] {
3
var stringsByCount = [[Int]: [String]]()
4
5
- strs.map { str in
+ strs.forEach { str in
6
var countsByAlphabet = Array(repeating: 0, count: 26)
7
for char in str.unicodeScalars {
8
countsByAlphabet[Int(char.value) - 97] += 1
0 commit comments