From f6e158ecf3eb08f8808eb75322a520fb2dd248c1 Mon Sep 17 00:00:00 2001 From: Noh Date: Wed, 23 Jul 2025 14:41:13 +0900 Subject: [PATCH 1/6] Two Sum solved --- two-sum/do-heewan.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 two-sum/do-heewan.py diff --git a/two-sum/do-heewan.py b/two-sum/do-heewan.py new file mode 100644 index 0000000000..b9498729c2 --- /dev/null +++ b/two-sum/do-heewan.py @@ -0,0 +1,10 @@ +class Solution(object): + def twoSum(self, nums, target): + result = [] + for i in range(len(nums)-1): + for j in range(i+1, len(nums)): + if (nums[i] + nums[j] == target): + result.append(i) + result.append(j) + + return result \ No newline at end of file From 2206296aa413c29788b37868e54cdba436c57100 Mon Sep 17 00:00:00 2001 From: Noh Date: Wed, 23 Jul 2025 15:11:53 +0900 Subject: [PATCH 2/6] Contains Duplicate solved --- contains-duplicate/do-heewan.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 contains-duplicate/do-heewan.py diff --git a/contains-duplicate/do-heewan.py b/contains-duplicate/do-heewan.py new file mode 100644 index 0000000000..04ed692680 --- /dev/null +++ b/contains-duplicate/do-heewan.py @@ -0,0 +1,7 @@ +class Solution: + def containsDuplicate(self, nums: List[int]) -> bool: + sets = set(nums) + + if len(nums) != len(sets): + return True + return False From 445d2921ce3d9e204f24aa96cb58d74715001b3a Mon Sep 17 00:00:00 2001 From: Noh Date: Wed, 23 Jul 2025 15:13:41 +0900 Subject: [PATCH 3/6] Two Sum solved --- two-sum/do-heewan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/two-sum/do-heewan.py b/two-sum/do-heewan.py index b9498729c2..5fdaeee44d 100644 --- a/two-sum/do-heewan.py +++ b/two-sum/do-heewan.py @@ -7,4 +7,4 @@ def twoSum(self, nums, target): result.append(i) result.append(j) - return result \ No newline at end of file + return result From 99826d9617db711ca04d922f4c1bc6d1c7b61cab Mon Sep 17 00:00:00 2001 From: Noh Date: Wed, 23 Jul 2025 15:14:50 +0900 Subject: [PATCH 4/6] Contains Duplicate solved --- contains-duplicate/do-heewan.py | 1 + 1 file changed, 1 insertion(+) diff --git a/contains-duplicate/do-heewan.py b/contains-duplicate/do-heewan.py index 04ed692680..59c26ce8bd 100644 --- a/contains-duplicate/do-heewan.py +++ b/contains-duplicate/do-heewan.py @@ -5,3 +5,4 @@ def containsDuplicate(self, nums: List[int]) -> bool: if len(nums) != len(sets): return True return False + From 004be14cb77b9a43fd8d7bceeded2cc5d202655f Mon Sep 17 00:00:00 2001 From: Noh Date: Thu, 24 Jul 2025 22:29:57 +0900 Subject: [PATCH 5/6] Top K Frequent --- top-k-frequent-elements/do-heewan.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 top-k-frequent-elements/do-heewan.py diff --git a/top-k-frequent-elements/do-heewan.py b/top-k-frequent-elements/do-heewan.py new file mode 100644 index 0000000000..9a1b386da3 --- /dev/null +++ b/top-k-frequent-elements/do-heewan.py @@ -0,0 +1,15 @@ +class Solution(object): + def topKFrequent(self, nums, k): + count = {} + result = [] + + for i in nums: + if i not in count: + count[i] = 1 + else: + count[i] += 1 + + count = sorted(count.items(), key=lambda x : x[1], reverse=True) + + return [item[0] for item in count[:k]] + \ No newline at end of file From 596cce5227a4835f7cea349df58cc8544854efe9 Mon Sep 17 00:00:00 2001 From: Noh Date: Thu, 24 Jul 2025 22:32:12 +0900 Subject: [PATCH 6/6] Top K Frequent solved --- top-k-frequent-elements/do-heewan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/top-k-frequent-elements/do-heewan.py b/top-k-frequent-elements/do-heewan.py index 9a1b386da3..d171025155 100644 --- a/top-k-frequent-elements/do-heewan.py +++ b/top-k-frequent-elements/do-heewan.py @@ -12,4 +12,4 @@ def topKFrequent(self, nums, k): count = sorted(count.items(), key=lambda x : x[1], reverse=True) return [item[0] for item in count[:k]] - \ No newline at end of file +