From a0fa13c77ce08579e8558fb256c0e7cffaa8e7bb Mon Sep 17 00:00:00 2001 From: hellojoyworldz Date: Fri, 26 Jun 2026 21:49:41 +0900 Subject: [PATCH 1/5] =?UTF-8?q?1=EC=A3=BC=EC=B0=A8=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contains-duplicate/hellojoyworldz.py | 12 ++++++++++++ house-robber/hellojoyworldz.py | 2 ++ longest-consecutive-sequence/hellojoyworldz.py | 2 ++ top-k-frequent-elements/hellojoyworldz.py | 2 ++ two-sum/hellojowyrldz.py | 2 ++ 5 files changed, 20 insertions(+) create mode 100644 contains-duplicate/hellojoyworldz.py create mode 100644 house-robber/hellojoyworldz.py create mode 100644 longest-consecutive-sequence/hellojoyworldz.py create mode 100644 top-k-frequent-elements/hellojoyworldz.py create mode 100644 two-sum/hellojowyrldz.py diff --git a/contains-duplicate/hellojoyworldz.py b/contains-duplicate/hellojoyworldz.py new file mode 100644 index 0000000000..5b0c9dd1aa --- /dev/null +++ b/contains-duplicate/hellojoyworldz.py @@ -0,0 +1,12 @@ +# - 문제: https://leetcode.com/problems/contains-duplicate/ +# - 해설: https://www.algodale.com/problems/contains-duplicate/ + +# 217. Contains Duplicate +# - Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. + +from typing import List + +class Solution: + def containsDuplicate(self, nums: List[int]) -> bool: + + return len(set(nums)) != len(nums) \ No newline at end of file diff --git a/house-robber/hellojoyworldz.py b/house-robber/hellojoyworldz.py new file mode 100644 index 0000000000..a5916b41f6 --- /dev/null +++ b/house-robber/hellojoyworldz.py @@ -0,0 +1,2 @@ +# - 문제: https://leetcode.com/problems/house-robber/ +# - 풀이: https://www.algodale.com/problems/house-robber/ \ No newline at end of file diff --git a/longest-consecutive-sequence/hellojoyworldz.py b/longest-consecutive-sequence/hellojoyworldz.py new file mode 100644 index 0000000000..2a1ba53f74 --- /dev/null +++ b/longest-consecutive-sequence/hellojoyworldz.py @@ -0,0 +1,2 @@ +# - 문제: https://leetcode.com/problems/longest-consecutive-sequence/ +# - 풀이: https://www.algodale.com/problems/longest-consecutive-sequence/ \ No newline at end of file diff --git a/top-k-frequent-elements/hellojoyworldz.py b/top-k-frequent-elements/hellojoyworldz.py new file mode 100644 index 0000000000..1fb40a30b0 --- /dev/null +++ b/top-k-frequent-elements/hellojoyworldz.py @@ -0,0 +1,2 @@ +# - 문제: https://leetcode.com/problems/top-k-frequent-elements/ +# - 풀이: https://www.algodale.com/problems/top-k-frequent-elements/ \ No newline at end of file diff --git a/two-sum/hellojowyrldz.py b/two-sum/hellojowyrldz.py new file mode 100644 index 0000000000..f06a59c646 --- /dev/null +++ b/two-sum/hellojowyrldz.py @@ -0,0 +1,2 @@ +# - 문제: https://leetcode.com/problems/two-sum/ +# - 해설: https://www.algodale.com/problems/two-sum/ \ No newline at end of file From 3869b3ec8d71b733c12c5ce9aaf8ad20d3fea0d8 Mon Sep 17 00:00:00 2001 From: hellojoyworldz Date: Fri, 26 Jun 2026 22:15:58 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=9D=98=20=EB=A7=88?= =?UTF-8?q?=EC=A7=80=EB=A7=89=EC=97=90=20=EA=B0=9C=ED=96=89=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=EB=A5=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contains-duplicate/hellojoyworldz.py | 2 +- house-robber/hellojoyworldz.py | 2 +- longest-consecutive-sequence/hellojoyworldz.py | 2 +- top-k-frequent-elements/hellojoyworldz.py | 2 +- two-sum/hellojowyrldz.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contains-duplicate/hellojoyworldz.py b/contains-duplicate/hellojoyworldz.py index 5b0c9dd1aa..590140ac4c 100644 --- a/contains-duplicate/hellojoyworldz.py +++ b/contains-duplicate/hellojoyworldz.py @@ -9,4 +9,4 @@ class Solution: def containsDuplicate(self, nums: List[int]) -> bool: - return len(set(nums)) != len(nums) \ No newline at end of file + return len(set(nums)) != len(nums) diff --git a/house-robber/hellojoyworldz.py b/house-robber/hellojoyworldz.py index a5916b41f6..6569b7ca4d 100644 --- a/house-robber/hellojoyworldz.py +++ b/house-robber/hellojoyworldz.py @@ -1,2 +1,2 @@ # - 문제: https://leetcode.com/problems/house-robber/ -# - 풀이: https://www.algodale.com/problems/house-robber/ \ No newline at end of file +# - 풀이: https://www.algodale.com/problems/house-robber/ diff --git a/longest-consecutive-sequence/hellojoyworldz.py b/longest-consecutive-sequence/hellojoyworldz.py index 2a1ba53f74..b1008b4998 100644 --- a/longest-consecutive-sequence/hellojoyworldz.py +++ b/longest-consecutive-sequence/hellojoyworldz.py @@ -1,2 +1,2 @@ # - 문제: https://leetcode.com/problems/longest-consecutive-sequence/ -# - 풀이: https://www.algodale.com/problems/longest-consecutive-sequence/ \ No newline at end of file +# - 풀이: https://www.algodale.com/problems/longest-consecutive-sequence/ diff --git a/top-k-frequent-elements/hellojoyworldz.py b/top-k-frequent-elements/hellojoyworldz.py index 1fb40a30b0..535166c56d 100644 --- a/top-k-frequent-elements/hellojoyworldz.py +++ b/top-k-frequent-elements/hellojoyworldz.py @@ -1,2 +1,2 @@ # - 문제: https://leetcode.com/problems/top-k-frequent-elements/ -# - 풀이: https://www.algodale.com/problems/top-k-frequent-elements/ \ No newline at end of file +# - 풀이: https://www.algodale.com/problems/top-k-frequent-elements/ diff --git a/two-sum/hellojowyrldz.py b/two-sum/hellojowyrldz.py index f06a59c646..220d0e7b19 100644 --- a/two-sum/hellojowyrldz.py +++ b/two-sum/hellojowyrldz.py @@ -1,2 +1,2 @@ # - 문제: https://leetcode.com/problems/two-sum/ -# - 해설: https://www.algodale.com/problems/two-sum/ \ No newline at end of file +# - 해설: https://www.algodale.com/problems/two-sum/ From 149c03f4e2d947c71775b7981a6ac949c5844fe9 Mon Sep 17 00:00:00 2001 From: Sunah Gwak Date: Fri, 26 Jun 2026 22:34:19 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=9D=98=20=EB=A7=88?= =?UTF-8?q?=EC=A7=80=EB=A7=89=EC=97=90=20=EA=B0=9C=ED=96=89=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contains-duplicate/hellojoyworldz.py | 1 + house-robber/hellojoyworldz.py | 1 + longest-consecutive-sequence/hellojoyworldz.py | 1 + top-k-frequent-elements/hellojoyworldz.py | 1 + two-sum/hellojowyrldz.py | 1 + 5 files changed, 5 insertions(+) diff --git a/contains-duplicate/hellojoyworldz.py b/contains-duplicate/hellojoyworldz.py index 590140ac4c..ad4b5ad482 100644 --- a/contains-duplicate/hellojoyworldz.py +++ b/contains-duplicate/hellojoyworldz.py @@ -10,3 +10,4 @@ class Solution: def containsDuplicate(self, nums: List[int]) -> bool: return len(set(nums)) != len(nums) + diff --git a/house-robber/hellojoyworldz.py b/house-robber/hellojoyworldz.py index 6569b7ca4d..26da025cc7 100644 --- a/house-robber/hellojoyworldz.py +++ b/house-robber/hellojoyworldz.py @@ -1,2 +1,3 @@ # - 문제: https://leetcode.com/problems/house-robber/ # - 풀이: https://www.algodale.com/problems/house-robber/ + diff --git a/longest-consecutive-sequence/hellojoyworldz.py b/longest-consecutive-sequence/hellojoyworldz.py index b1008b4998..9f1870cef1 100644 --- a/longest-consecutive-sequence/hellojoyworldz.py +++ b/longest-consecutive-sequence/hellojoyworldz.py @@ -1,2 +1,3 @@ # - 문제: https://leetcode.com/problems/longest-consecutive-sequence/ # - 풀이: https://www.algodale.com/problems/longest-consecutive-sequence/ + diff --git a/top-k-frequent-elements/hellojoyworldz.py b/top-k-frequent-elements/hellojoyworldz.py index 535166c56d..29fb7ca525 100644 --- a/top-k-frequent-elements/hellojoyworldz.py +++ b/top-k-frequent-elements/hellojoyworldz.py @@ -1,2 +1,3 @@ # - 문제: https://leetcode.com/problems/top-k-frequent-elements/ # - 풀이: https://www.algodale.com/problems/top-k-frequent-elements/ + diff --git a/two-sum/hellojowyrldz.py b/two-sum/hellojowyrldz.py index 220d0e7b19..9aa050307d 100644 --- a/two-sum/hellojowyrldz.py +++ b/two-sum/hellojowyrldz.py @@ -1,2 +1,3 @@ # - 문제: https://leetcode.com/problems/two-sum/ # - 해설: https://www.algodale.com/problems/two-sum/ + From addbe1186e4ef653433c43775a49eb97874f2393 Mon Sep 17 00:00:00 2001 From: Sunah Gwak Date: Fri, 26 Jun 2026 22:36:27 +0900 Subject: [PATCH 4/5] =?UTF-8?q?two-sum=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- two-sum/{hellojowyrldz.py => hellojoyworldz.py} | 1 - 1 file changed, 1 deletion(-) rename two-sum/{hellojowyrldz.py => hellojoyworldz.py} (99%) diff --git a/two-sum/hellojowyrldz.py b/two-sum/hellojoyworldz.py similarity index 99% rename from two-sum/hellojowyrldz.py rename to two-sum/hellojoyworldz.py index 9aa050307d..220d0e7b19 100644 --- a/two-sum/hellojowyrldz.py +++ b/two-sum/hellojoyworldz.py @@ -1,3 +1,2 @@ # - 문제: https://leetcode.com/problems/two-sum/ # - 해설: https://www.algodale.com/problems/two-sum/ - From 435576e39e56b6160b5b4d5457e27ec57286a28f Mon Sep 17 00:00:00 2001 From: Sunah Gwak Date: Sat, 27 Jun 2026 19:55:26 +0900 Subject: [PATCH 5/5] =?UTF-8?q?week01=20=EB=AC=B8=EC=A0=9C=ED=92=80?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- house-robber/hellojoyworldz.py | 15 ++++++++++++ .../hellojoyworldz.py | 23 +++++++++++++++++++ top-k-frequent-elements/hellojoyworldz.py | 9 ++++++++ two-sum/hellojoyworldz.py | 15 ++++++++++++ 4 files changed, 62 insertions(+) diff --git a/house-robber/hellojoyworldz.py b/house-robber/hellojoyworldz.py index 26da025cc7..1a84cc81fc 100644 --- a/house-robber/hellojoyworldz.py +++ b/house-robber/hellojoyworldz.py @@ -1,3 +1,18 @@ # - 문제: https://leetcode.com/problems/house-robber/ # - 풀이: https://www.algodale.com/problems/house-robber/ +from typing import List + + +class Solution: + def rob(self, nums: List[int]) -> int: + prev1 = 0 + prev2 = 0 + + for num in nums: + current = max(prev1, prev2 + num) + prev2 = prev1 + prev1 = current + + return prev1 + diff --git a/longest-consecutive-sequence/hellojoyworldz.py b/longest-consecutive-sequence/hellojoyworldz.py index 9f1870cef1..cf7e8a5f98 100644 --- a/longest-consecutive-sequence/hellojoyworldz.py +++ b/longest-consecutive-sequence/hellojoyworldz.py @@ -1,3 +1,26 @@ # - 문제: https://leetcode.com/problems/longest-consecutive-sequence/ # - 풀이: https://www.algodale.com/problems/longest-consecutive-sequence/ +# Current complexity:O(NlogN) +# Suggested complexity:O(N) + +from typing import List + + +class Solution: + def longestConsecutive(self, nums: List[int]) -> int: + + sorted_nums = sorted(set(nums)) + + max_sequence = 1 + current_sequence = 1 + + for i in range(1, len(sorted_nums)): + if sorted_nums[i] - sorted_nums[i - 1] == 1: + current_sequence += 1 + max_sequence = max(max_sequence, current_sequence) + else: + current_sequence = 1 + + return max(max_sequence, current_sequence) + diff --git a/top-k-frequent-elements/hellojoyworldz.py b/top-k-frequent-elements/hellojoyworldz.py index 29fb7ca525..4fd0d5cfa4 100644 --- a/top-k-frequent-elements/hellojoyworldz.py +++ b/top-k-frequent-elements/hellojoyworldz.py @@ -1,3 +1,12 @@ # - 문제: https://leetcode.com/problems/top-k-frequent-elements/ # - 풀이: https://www.algodale.com/problems/top-k-frequent-elements/ +from collections import Counter +from typing import List + + +class Solution: + def topKFrequent(self, nums: List[int], k: int) -> List[int]: + counter = Counter(nums) + return [num for num, count in counter.most_common(k)] + diff --git a/two-sum/hellojoyworldz.py b/two-sum/hellojoyworldz.py index 220d0e7b19..925ce62148 100644 --- a/two-sum/hellojoyworldz.py +++ b/two-sum/hellojoyworldz.py @@ -1,2 +1,17 @@ # - 문제: https://leetcode.com/problems/two-sum/ # - 해설: https://www.algodale.com/problems/two-sum/ + +from typing import List + + +class Solution: + def twoSum(self, nums: List[int], target: int) -> List[int]: + for first_index, first_num in enumerate(nums): + for second_index, second_num in enumerate(nums): + if first_index == second_index: + continue + if first_num + second_num == target: + return [first_index, second_index] + + return [] +