728x90
반응형
leetcode.com/problems/group-anagrams/
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
ana = collections.defaultdict(list)
for word in strs:
ana[''.join(sorted(word))].append(word)
return ana.values()
728x90
반응형
'Archive > Develop' 카테고리의 다른 글
[ Django ]ORM ( Object-Relational Mapping ) 이란 무엇인가 (0) | 2021.04.24 |
---|---|
[ GitHub ] Build Docker Image with Private Repo (0) | 2021.04.24 |
[ LeetCode ] 819번 Most Common Word (0) | 2021.04.18 |
[ LeetCode ] 937번 Reorder Data in Log Files 풀이 (0) | 2021.04.16 |
[ LeetCode ] 344번 Reverse String (0) | 2021.04.15 |