From b064d995e3fea7580474ed95eae7b284a9833aaa Mon Sep 17 00:00:00 2001 From: ayleeee Date: Sun, 30 Mar 2025 22:38:23 +0900 Subject: [PATCH 1/4] contains-duplicate solution --- contains-duplicate/ayleeee.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 contains-duplicate/ayleeee.py diff --git a/contains-duplicate/ayleeee.py b/contains-duplicate/ayleeee.py new file mode 100644 index 000000000..e5933c112 --- /dev/null +++ b/contains-duplicate/ayleeee.py @@ -0,0 +1,4 @@ +class Solution: + def containsDuplicate(self, nums: List[int]) -> bool: + return len(set(nums))!=len(nums) + From 969e9d4ad5f127853ec5d169656c62e0e38e537c Mon Sep 17 00:00:00 2001 From: ayleeee Date: Sun, 30 Mar 2025 23:08:57 +0900 Subject: [PATCH 2/4] two-sum solution --- two-sum/ayleeee.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 two-sum/ayleeee.py diff --git a/two-sum/ayleeee.py b/two-sum/ayleeee.py new file mode 100644 index 000000000..34d5572fe --- /dev/null +++ b/two-sum/ayleeee.py @@ -0,0 +1,6 @@ +class Solution: + def twoSum(self, nums: List[int], target: int) -> List[int]: + for a in range(len(nums)): + for b in range(a+1,len(nums)): + if nums[a]+nums[b]==target: + return [a,b] From cbe39c8102be4b058560c6d042c4c10fe6d22ce6 Mon Sep 17 00:00:00 2001 From: ayleeee Date: Tue, 1 Apr 2025 14:56:59 +0900 Subject: [PATCH 3/4] top k frequent elements solution --- top-k-frequent-elements/ayleeee.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 top-k-frequent-elements/ayleeee.py diff --git a/top-k-frequent-elements/ayleeee.py b/top-k-frequent-elements/ayleeee.py new file mode 100644 index 000000000..3740d43b7 --- /dev/null +++ b/top-k-frequent-elements/ayleeee.py @@ -0,0 +1,10 @@ +class Solution: + def topKFrequent(self, nums: List[int], k: int) -> List[int]: + dict_map = {} + for a in nums: + if a in dict_map: + dict_map[a] += 1 + else: + dict_map[a] = 1 + lst = sorted(dict_map.items(), key=lambda x: x[1], reverse=True) # 공백 수정 + return [item[0] for item in lst[0:k]] \ No newline at end of file From ddbe97737043acbc985b1d763c5d60d371f0e2c1 Mon Sep 17 00:00:00 2001 From: ayleeee <86951396+ayleeee@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:39:45 +0900 Subject: [PATCH 4/4] top k frequent elements edited --- top-k-frequent-elements/ayleeee.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/top-k-frequent-elements/ayleeee.py b/top-k-frequent-elements/ayleeee.py index 3740d43b7..2cdb1503b 100644 --- a/top-k-frequent-elements/ayleeee.py +++ b/top-k-frequent-elements/ayleeee.py @@ -7,4 +7,5 @@ def topKFrequent(self, nums: List[int], k: int) -> List[int]: else: dict_map[a] = 1 lst = sorted(dict_map.items(), key=lambda x: x[1], reverse=True) # 공백 수정 - return [item[0] for item in lst[0:k]] \ No newline at end of file + return [item[0] for item in lst[0:k]] +