From 31ad06363f257b998c94601295b9ceaa34d1d9a3 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Sat, 15 Nov 2025 22:41:40 +0900 Subject: [PATCH 1/9] WEEK 01: two sum solution --- two-sum/mandel-17.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 two-sum/mandel-17.py diff --git a/two-sum/mandel-17.py b/two-sum/mandel-17.py new file mode 100644 index 0000000000..1735616c1e --- /dev/null +++ b/two-sum/mandel-17.py @@ -0,0 +1,9 @@ +from typing import List + +class Solution: + def twoSum(self, nums: List[int], target: int) -> List[int]: + for i, v in enumerate(nums): + second_value = target - v + + if second_value in nums[i+1:]: + return [i, nums[i+1:].index(second_value) + i+1] \ No newline at end of file From 0a3b42a8bb5db55026879e87429531eac7f1a282 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Sat, 15 Nov 2025 22:42:10 +0900 Subject: [PATCH 2/9] Week 01: contains-duplicate solution --- contains-duplicate/mandel-17.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 contains-duplicate/mandel-17.py diff --git a/contains-duplicate/mandel-17.py b/contains-duplicate/mandel-17.py new file mode 100644 index 0000000000..aa3cb370a9 --- /dev/null +++ b/contains-duplicate/mandel-17.py @@ -0,0 +1,13 @@ +from typing import List + +class Solution: + def containsDuplicate(self, nums: List[int]) -> bool: + stack_list = [] + for i, n in enumerate(nums[:-1]): + stack_list.append(n) + if nums[i+1] in stack_list: + return True + else: + if i == len(nums[:-2]): + return False + continue \ No newline at end of file From 9131a4ba1963ad52f0857407bfd5abab5dc74319 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Sat, 15 Nov 2025 22:42:35 +0900 Subject: [PATCH 3/9] Week 01: top-k-frequent-elements solution --- top-k-frequent-elements/mandel-17.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 top-k-frequent-elements/mandel-17.py diff --git a/top-k-frequent-elements/mandel-17.py b/top-k-frequent-elements/mandel-17.py new file mode 100644 index 0000000000..a151795cf0 --- /dev/null +++ b/top-k-frequent-elements/mandel-17.py @@ -0,0 +1,13 @@ +from typing import List + +class Solution: + def topKFrequent(self, nums: List[int], k: int) -> List[int]: + nums_dict = {} + for n in nums: + if n not in nums_dict.keys(): + nums_dict[n] = 1 + else: + nums_dict[n] += 1 + + frequent_rank = sorted(nums_dict.items(), key=lambda item:item[1], reverse=True) + return [frequent_rank[j][0] for j in range(k)] From 6f3acd66be1fce48a0c9ccda81ae72df08de0b03 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Sat, 15 Nov 2025 22:50:30 +0900 Subject: [PATCH 4/9] Add new line for Posix --- contains-duplicate/mandel-17.py | 3 ++- top-k-frequent-elements/mandel-17.py | 1 + two-sum/mandel-17.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/contains-duplicate/mandel-17.py b/contains-duplicate/mandel-17.py index aa3cb370a9..ee9db5c6c3 100644 --- a/contains-duplicate/mandel-17.py +++ b/contains-duplicate/mandel-17.py @@ -10,4 +10,5 @@ def containsDuplicate(self, nums: List[int]) -> bool: else: if i == len(nums[:-2]): return False - continue \ No newline at end of file + continue + \ No newline at end of file diff --git a/top-k-frequent-elements/mandel-17.py b/top-k-frequent-elements/mandel-17.py index a151795cf0..3f25e0a69c 100644 --- a/top-k-frequent-elements/mandel-17.py +++ b/top-k-frequent-elements/mandel-17.py @@ -11,3 +11,4 @@ def topKFrequent(self, nums: List[int], k: int) -> List[int]: frequent_rank = sorted(nums_dict.items(), key=lambda item:item[1], reverse=True) return [frequent_rank[j][0] for j in range(k)] + \ No newline at end of file diff --git a/two-sum/mandel-17.py b/two-sum/mandel-17.py index 1735616c1e..7561acf85b 100644 --- a/two-sum/mandel-17.py +++ b/two-sum/mandel-17.py @@ -6,4 +6,5 @@ def twoSum(self, nums: List[int], target: int) -> List[int]: second_value = target - v if second_value in nums[i+1:]: - return [i, nums[i+1:].index(second_value) + i+1] \ No newline at end of file + return [i, nums[i+1:].index(second_value) + i+1] + \ No newline at end of file From 7816a7650e687d6428e58e774638d243b80dfae0 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Sun, 16 Nov 2025 01:05:37 +0900 Subject: [PATCH 5/9] Readd new line --- contains-duplicate/mandel-17.py | 2 +- top-k-frequent-elements/mandel-17.py | 1 + two-sum/mandel-17.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/contains-duplicate/mandel-17.py b/contains-duplicate/mandel-17.py index ee9db5c6c3..9f6abb0f42 100644 --- a/contains-duplicate/mandel-17.py +++ b/contains-duplicate/mandel-17.py @@ -11,4 +11,4 @@ def containsDuplicate(self, nums: List[int]) -> bool: if i == len(nums[:-2]): return False continue - \ No newline at end of file + diff --git a/top-k-frequent-elements/mandel-17.py b/top-k-frequent-elements/mandel-17.py index 3f25e0a69c..45ac1dee6c 100644 --- a/top-k-frequent-elements/mandel-17.py +++ b/top-k-frequent-elements/mandel-17.py @@ -11,4 +11,5 @@ def topKFrequent(self, nums: List[int], k: int) -> List[int]: frequent_rank = sorted(nums_dict.items(), key=lambda item:item[1], reverse=True) return [frequent_rank[j][0] for j in range(k)] + \ No newline at end of file diff --git a/two-sum/mandel-17.py b/two-sum/mandel-17.py index 7561acf85b..a186df95e1 100644 --- a/two-sum/mandel-17.py +++ b/two-sum/mandel-17.py @@ -7,4 +7,4 @@ def twoSum(self, nums: List[int], target: int) -> List[int]: if second_value in nums[i+1:]: return [i, nums[i+1:].index(second_value) + i+1] - \ No newline at end of file + From c477a8e228727891f25b58f106753bd8cccd2a9a Mon Sep 17 00:00:00 2001 From: sangyoon Date: Sun, 16 Nov 2025 01:08:29 +0900 Subject: [PATCH 6/9] recommit for posix: --- contains-duplicate/mandel-17.py | 3 +-- top-k-frequent-elements/mandel-17.py | 4 +--- two-sum/mandel-17.py | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/contains-duplicate/mandel-17.py b/contains-duplicate/mandel-17.py index 9f6abb0f42..aa3cb370a9 100644 --- a/contains-duplicate/mandel-17.py +++ b/contains-duplicate/mandel-17.py @@ -10,5 +10,4 @@ def containsDuplicate(self, nums: List[int]) -> bool: else: if i == len(nums[:-2]): return False - continue - + continue \ No newline at end of file diff --git a/top-k-frequent-elements/mandel-17.py b/top-k-frequent-elements/mandel-17.py index 45ac1dee6c..f1e1d83af4 100644 --- a/top-k-frequent-elements/mandel-17.py +++ b/top-k-frequent-elements/mandel-17.py @@ -10,6 +10,4 @@ def topKFrequent(self, nums: List[int], k: int) -> List[int]: nums_dict[n] += 1 frequent_rank = sorted(nums_dict.items(), key=lambda item:item[1], reverse=True) - return [frequent_rank[j][0] for j in range(k)] - - \ No newline at end of file + return [frequent_rank[j][0] for j in range(k)] \ No newline at end of file diff --git a/two-sum/mandel-17.py b/two-sum/mandel-17.py index a186df95e1..1735616c1e 100644 --- a/two-sum/mandel-17.py +++ b/two-sum/mandel-17.py @@ -6,5 +6,4 @@ def twoSum(self, nums: List[int], target: int) -> List[int]: second_value = target - v if second_value in nums[i+1:]: - return [i, nums[i+1:].index(second_value) + i+1] - + return [i, nums[i+1:].index(second_value) + i+1] \ No newline at end of file From feca30b7610d5476913e6898c250ffae5c5830a1 Mon Sep 17 00:00:00 2001 From: mandel <86548085+mandel-17@users.noreply.github.com> Date: Sun, 16 Nov 2025 01:09:54 +0900 Subject: [PATCH 7/9] Update mandel-17.py --- two-sum/mandel-17.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/two-sum/mandel-17.py b/two-sum/mandel-17.py index 1735616c1e..029fde1a89 100644 --- a/two-sum/mandel-17.py +++ b/two-sum/mandel-17.py @@ -6,4 +6,5 @@ def twoSum(self, nums: List[int], target: int) -> List[int]: second_value = target - v if second_value in nums[i+1:]: - return [i, nums[i+1:].index(second_value) + i+1] \ No newline at end of file + return [i, nums[i+1:].index(second_value) + i+1] + From 161d98364f3cc9dfda101e55f0dea9ee0cdc1e6f Mon Sep 17 00:00:00 2001 From: mandel <86548085+mandel-17@users.noreply.github.com> Date: Sun, 16 Nov 2025 01:10:59 +0900 Subject: [PATCH 8/9] Update mandel-17.py --- contains-duplicate/mandel-17.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contains-duplicate/mandel-17.py b/contains-duplicate/mandel-17.py index aa3cb370a9..4aa2f4a003 100644 --- a/contains-duplicate/mandel-17.py +++ b/contains-duplicate/mandel-17.py @@ -10,4 +10,5 @@ def containsDuplicate(self, nums: List[int]) -> bool: else: if i == len(nums[:-2]): return False - continue \ No newline at end of file + continue + From 8d3ed219315ca3f5fd31994205ecf47cd00805af Mon Sep 17 00:00:00 2001 From: mandel <86548085+mandel-17@users.noreply.github.com> Date: Sun, 16 Nov 2025 01:11:57 +0900 Subject: [PATCH 9/9] Update mandel-17.py --- top-k-frequent-elements/mandel-17.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/top-k-frequent-elements/mandel-17.py b/top-k-frequent-elements/mandel-17.py index f1e1d83af4..775721df2f 100644 --- a/top-k-frequent-elements/mandel-17.py +++ b/top-k-frequent-elements/mandel-17.py @@ -10,4 +10,5 @@ def topKFrequent(self, nums: List[int], k: int) -> List[int]: nums_dict[n] += 1 frequent_rank = sorted(nums_dict.items(), key=lambda item:item[1], reverse=True) - return [frequent_rank[j][0] for j in range(k)] \ No newline at end of file + return [frequent_rank[j][0] for j in range(k)] +