From c474203d39e29d932760f09ecaa3b6e1d5f1a99e Mon Sep 17 00:00:00 2001 From: kim heoung doon <63146721+chapse57@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:54:19 +0900 Subject: [PATCH 1/5] Add contains-duplicate solution --- contains-duplicate/chapse57.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 contains-duplicate/chapse57.py diff --git a/contains-duplicate/chapse57.py b/contains-duplicate/chapse57.py new file mode 100644 index 0000000000..c0095bea02 --- /dev/null +++ b/contains-duplicate/chapse57.py @@ -0,0 +1,11 @@ +class Solution(object): + def containsDuplicate(self, nums): + """ + :type nums: List[int] + :rtype: bool + """ + for i in range(len(nums)): + for j in range(i+1,len(nums)): + if nums[i] == nums[j]: + return True + return False \ No newline at end of file From 9e5326588ed1fff68f172757534852a0bca14e26 Mon Sep 17 00:00:00 2001 From: kim heoung doon <63146721+chapse57@users.noreply.github.com> Date: Fri, 26 Jun 2026 17:05:47 +0900 Subject: [PATCH 2/5] [chapse57] Week 1 --- top-k-frequent-elements/chapse57.py | 20 ++++++++++++++++++++ two-sum/chapse57.py | 12 ++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 top-k-frequent-elements/chapse57.py create mode 100644 two-sum/chapse57.py diff --git a/top-k-frequent-elements/chapse57.py b/top-k-frequent-elements/chapse57.py new file mode 100644 index 0000000000..5288aecbc8 --- /dev/null +++ b/top-k-frequent-elements/chapse57.py @@ -0,0 +1,20 @@ +class Solution(object): + def topKFrequent(self, nums, k): + """ + :type nums: List[int] + :type k: int + :rtype: List[int] + """ + count = {} + for n in nums: + if n in count: + count[n] +=1 + else: + count[n] =1 + # count.items()를 횟수 큰 순으로 정렬 + freq = sorted(count.items(), key=lambda x: x[1], reverse=True) + + result = [] + for x in freq[:k]: + result.append(x[0]) + return result \ No newline at end of file diff --git a/two-sum/chapse57.py b/two-sum/chapse57.py new file mode 100644 index 0000000000..05cdae5612 --- /dev/null +++ b/two-sum/chapse57.py @@ -0,0 +1,12 @@ +class Solution(object): + def twoSum(self, nums, target): + """ + :type nums: List[int] + :type target: int + :rtype: List[int] + """ + seen = {} + for i in range(len(nums)): + if (target - nums[i]) in seen: + return [seen[target - nums[i]],i] + seen[nums[i]] =i \ No newline at end of file From 6895637d43f41a728ff014025121689beaef0384 Mon Sep 17 00:00:00 2001 From: kim heoung doon <63146721+chapse57@users.noreply.github.com> Date: Fri, 26 Jun 2026 17:34:37 +0900 Subject: [PATCH 3/5] fix: add final newline --- contains-duplicate/chapse57.py | 2 +- top-k-frequent-elements/chapse57.py | 4 +++- two-sum/chapse57.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/contains-duplicate/chapse57.py b/contains-duplicate/chapse57.py index c0095bea02..1cb32db06f 100644 --- a/contains-duplicate/chapse57.py +++ b/contains-duplicate/chapse57.py @@ -8,4 +8,4 @@ def containsDuplicate(self, nums): for j in range(i+1,len(nums)): if nums[i] == nums[j]: return True - return False \ No newline at end of file + return False diff --git a/top-k-frequent-elements/chapse57.py b/top-k-frequent-elements/chapse57.py index 5288aecbc8..99cd374eb8 100644 --- a/top-k-frequent-elements/chapse57.py +++ b/top-k-frequent-elements/chapse57.py @@ -17,4 +17,6 @@ def topKFrequent(self, nums, k): result = [] for x in freq[:k]: result.append(x[0]) - return result \ No newline at end of file + return result + + diff --git a/two-sum/chapse57.py b/two-sum/chapse57.py index 05cdae5612..b83b732ef1 100644 --- a/two-sum/chapse57.py +++ b/two-sum/chapse57.py @@ -9,4 +9,6 @@ def twoSum(self, nums, target): for i in range(len(nums)): if (target - nums[i]) in seen: return [seen[target - nums[i]],i] - seen[nums[i]] =i \ No newline at end of file + seen[nums[i]] =i + + From afde7ad9a74f5bcc4037f6c8faf0e7275dc5e5d8 Mon Sep 17 00:00:00 2001 From: kim heoung doon <63146721+chapse57@users.noreply.github.com> Date: Tue, 30 Jun 2026 16:32:42 +0900 Subject: [PATCH 4/5] [chapse57] Week 2 --- valid-anagram/chapse57.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 valid-anagram/chapse57.py diff --git a/valid-anagram/chapse57.py b/valid-anagram/chapse57.py new file mode 100644 index 0000000000..98224ed5ad --- /dev/null +++ b/valid-anagram/chapse57.py @@ -0,0 +1,11 @@ +class Solution(object): + def isAnagram(self, s, t): + """ + :type s: str + :type t: str + :rtype: bool + """ + return sorted(s) == sorted(t) + + + \ No newline at end of file From 888fb598f5d7e596d8a3f3b6eefeeffd4a175672 Mon Sep 17 00:00:00 2001 From: kim heoung doon <63146721+chapse57@users.noreply.github.com> Date: Wed, 1 Jul 2026 22:30:48 +0900 Subject: [PATCH 5/5] [chapse57] Week 2 - Group Anagrams --- group-anagrams/chapse57.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 group-anagrams/chapse57.py diff --git a/group-anagrams/chapse57.py b/group-anagrams/chapse57.py new file mode 100644 index 0000000000..b8f51db670 --- /dev/null +++ b/group-anagrams/chapse57.py @@ -0,0 +1,17 @@ +class Solution(object): + def groupAnagrams(self, strs): + """ + :type strs: List[str] + :rtype: List[List[str]] + """ + seen = {} + for word in strs: + key = "".join(sorted(word)) + # key가 seen에 이미 있으면 → word 추가 + # 없으면 → 새로 만들기 + if key in seen: + seen[key].append(word) + else: + seen[key] = [word] + return list(seen.values()) +