From 3bfd34a2bd954627ba68903b619c4131f928811e Mon Sep 17 00:00:00 2001 From: hyh Date: Fri, 14 Nov 2025 17:09:05 +0900 Subject: [PATCH 1/8] contains duplicate --- contains-duplicate/deepInTheWoodz.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 contains-duplicate/deepInTheWoodz.py diff --git a/contains-duplicate/deepInTheWoodz.py b/contains-duplicate/deepInTheWoodz.py new file mode 100644 index 000000000..ca50a5ee8 --- /dev/null +++ b/contains-duplicate/deepInTheWoodz.py @@ -0,0 +1,9 @@ +class Solution: + def containsDuplicate(self, nums: List[int]) -> bool: + s = set() + for num in nums: + if num in s: + return True + else: + s.add(num) + return False \ No newline at end of file From d7224f955f6ba8802593418be979f8e258da38b4 Mon Sep 17 00:00:00 2001 From: hyh Date: Fri, 14 Nov 2025 21:42:36 +0900 Subject: [PATCH 2/8] contains duplicate- after review --- contains-duplicate/deepInTheWoodz.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contains-duplicate/deepInTheWoodz.py b/contains-duplicate/deepInTheWoodz.py index ca50a5ee8..7d8b9dabc 100644 --- a/contains-duplicate/deepInTheWoodz.py +++ b/contains-duplicate/deepInTheWoodz.py @@ -4,6 +4,6 @@ def containsDuplicate(self, nums: List[int]) -> bool: for num in nums: if num in s: return True - else: - s.add(num) - return False \ No newline at end of file + s.add(num) + return False + \ No newline at end of file From 698c2b63237bafd0d46429c7af7aae3ad5ab7866 Mon Sep 17 00:00:00 2001 From: hyh Date: Fri, 14 Nov 2025 21:45:30 +0900 Subject: [PATCH 3/8] contains duplicate-line break add --- contains-duplicate/deepInTheWoodz.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contains-duplicate/deepInTheWoodz.py b/contains-duplicate/deepInTheWoodz.py index 7d8b9dabc..41be67b14 100644 --- a/contains-duplicate/deepInTheWoodz.py +++ b/contains-duplicate/deepInTheWoodz.py @@ -1,9 +1,9 @@ -class Solution: - def containsDuplicate(self, nums: List[int]) -> bool: - s = set() - for num in nums: - if num in s: - return True - s.add(num) - return False +class Solution: + def containsDuplicate(self, nums: List[int]) -> bool: + s = set() + for num in nums: + if num in s: + return True + s.add(num) + return False \ No newline at end of file From bc4865ca109a498548ea75e80c9ad0b70833b9ab Mon Sep 17 00:00:00 2001 From: hyh Date: Fri, 14 Nov 2025 21:53:50 +0900 Subject: [PATCH 4/8] contains duplicate-line break add2 --- contains-duplicate/deepInTheWoodz.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/contains-duplicate/deepInTheWoodz.py b/contains-duplicate/deepInTheWoodz.py index 41be67b14..18a40f5f8 100644 --- a/contains-duplicate/deepInTheWoodz.py +++ b/contains-duplicate/deepInTheWoodz.py @@ -1,9 +1,8 @@ -class Solution: - def containsDuplicate(self, nums: List[int]) -> bool: - s = set() - for num in nums: - if num in s: - return True - s.add(num) - return False - \ No newline at end of file +class Solution: + def containsDuplicate(self, nums: List[int]) -> bool: + s = set() + for num in nums: + if num in s: + return True + s.add(num) + return False From 6dc68e4359347754cba898e3f3540617e5880823 Mon Sep 17 00:00:00 2001 From: hyh Date: Fri, 14 Nov 2025 22:21:35 +0900 Subject: [PATCH 5/8] two sum --- two-sum/deepInTheWoodz.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 two-sum/deepInTheWoodz.py diff --git a/two-sum/deepInTheWoodz.py b/two-sum/deepInTheWoodz.py new file mode 100644 index 000000000..ce7b79c98 --- /dev/null +++ b/two-sum/deepInTheWoodz.py @@ -0,0 +1,10 @@ +class Solution: + def twoSum(self, nums: List[int], target: int) -> List[int]: + passed = dict() + + for i, num in enumerate(nums): + other = target - num + if other in passed: + return [passed[other], i] + passed[num] = i + \ No newline at end of file From 7a2ab9179814d732995468d21546775cc05ea81f Mon Sep 17 00:00:00 2001 From: hyh Date: Fri, 14 Nov 2025 22:25:24 +0900 Subject: [PATCH 6/8] two sum-newline --- two-sum/deepInTheWoodz.py | 1 - 1 file changed, 1 deletion(-) diff --git a/two-sum/deepInTheWoodz.py b/two-sum/deepInTheWoodz.py index ce7b79c98..b93869aa9 100644 --- a/two-sum/deepInTheWoodz.py +++ b/two-sum/deepInTheWoodz.py @@ -7,4 +7,3 @@ def twoSum(self, nums: List[int], target: int) -> List[int]: if other in passed: return [passed[other], i] passed[num] = i - \ No newline at end of file From 665b9bba8d337868b3a9f64af90b3953cf44ccbb Mon Sep 17 00:00:00 2001 From: hyh Date: Fri, 14 Nov 2025 23:30:39 +0900 Subject: [PATCH 7/8] top k --- top-k-frequent-elements/deepInTheWoodz.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 top-k-frequent-elements/deepInTheWoodz.py diff --git a/top-k-frequent-elements/deepInTheWoodz.py b/top-k-frequent-elements/deepInTheWoodz.py new file mode 100644 index 000000000..7079572a3 --- /dev/null +++ b/top-k-frequent-elements/deepInTheWoodz.py @@ -0,0 +1,12 @@ +class Solution: + def topKFrequent(self, nums: List[int], k: int) -> List[int]: + counter = dict() + + for num in nums: + if num in counter: + counter[num] += 1 + else: + counter[num] = 1 + + return [num[0] for num in sorted(counter.items(), key=lambda x: x[1])[-k:]] + \ No newline at end of file From a95f534871037458fb02fd130ba88bb6b38a571c Mon Sep 17 00:00:00 2001 From: hyh Date: Sun, 16 Nov 2025 22:59:13 +0900 Subject: [PATCH 8/8] top k-newline --- top-k-frequent-elements/deepInTheWoodz.py | 1 - 1 file changed, 1 deletion(-) diff --git a/top-k-frequent-elements/deepInTheWoodz.py b/top-k-frequent-elements/deepInTheWoodz.py index 7079572a3..b1ffe48ca 100644 --- a/top-k-frequent-elements/deepInTheWoodz.py +++ b/top-k-frequent-elements/deepInTheWoodz.py @@ -9,4 +9,3 @@ def topKFrequent(self, nums: List[int], k: int) -> List[int]: counter[num] = 1 return [num[0] for num in sorted(counter.items(), key=lambda x: x[1])[-k:]] - \ No newline at end of file