Skip to content

Commit 57b41ad

Browse files
committed
solution: 0049. Group Anagrams
1 parent 13083db commit 57b41ad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
},
1515
"python.testing.pytestArgs": ["solutions"],
1616
"python.testing.unittestEnabled": false,
17-
"python.testing.pytestEnabled": true
17+
"python.testing.pytestEnabled": true,
18+
"ruff.lint.select": ["F401"]
1819
}

solutions/solution_0049/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import collections
2-
from typing import List
32

43

54
class Solution:
6-
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
5+
def groupAnagrams(self, strs: list[str]) -> list[list[str]]:
76
anagrams = collections.defaultdict(list)
87

98
for word in strs:
10-
anagrams["".join(sorted(word))].append(word)
9+
anagrams[''.join(sorted(word))].append(word)
1110

1211
return list(anagrams.values())

0 commit comments

Comments
 (0)