From 83a45255133b7cd98bb7e9765649273a627e44b0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 5 Jul 2026 05:00:34 -0600 Subject: [PATCH] adding updates --- .../round_1/11_group_anagrams.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/my_project/interviews/google_top_exercises/round_1/11_group_anagrams.py diff --git a/src/my_project/interviews/google_top_exercises/round_1/11_group_anagrams.py b/src/my_project/interviews/google_top_exercises/round_1/11_group_anagrams.py new file mode 100644 index 00000000..fad0a4d3 --- /dev/null +++ b/src/my_project/interviews/google_top_exercises/round_1/11_group_anagrams.py @@ -0,0 +1,12 @@ +from collections import defaultdict +from typing import List + +class Solution: + def groupAnagrams(self, strs: List[str]) -> List[List[str]]: + + answer = defaultdict(list) + + for word in strs: + answer[''.join(sorted(word))].append(word) + + return list(answer.values()) \ No newline at end of file