From 20196cd3e0277fdedace927c3970f0988e415b13 Mon Sep 17 00:00:00 2001 From: Boreum Date: Tue, 8 Apr 2025 22:45:33 +0900 Subject: [PATCH 1/3] add: valid-anagram solved --- valid-anagram/JiHyeonSu.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 valid-anagram/JiHyeonSu.py diff --git a/valid-anagram/JiHyeonSu.py b/valid-anagram/JiHyeonSu.py new file mode 100644 index 000000000..478db78fb --- /dev/null +++ b/valid-anagram/JiHyeonSu.py @@ -0,0 +1,7 @@ +# 재배치하여 다른 문자를 만들 수 있는지 여부 +# 시간복잡도 / 공간복잡도 O(n) + +class Solution: + def isAnagram(self, s: str, t: str) -> bool: + return Counter(s) == Counter(t) + From f7461ac5981958c164a39759662e183da4dc68ca Mon Sep 17 00:00:00 2001 From: Boreum Date: Fri, 11 Apr 2025 15:48:50 +0900 Subject: [PATCH 2/3] add: climbing stairs solved --- climbing-stairs/JiHyeonSu.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 climbing-stairs/JiHyeonSu.py diff --git a/climbing-stairs/JiHyeonSu.py b/climbing-stairs/JiHyeonSu.py new file mode 100644 index 000000000..c16c4fdb3 --- /dev/null +++ b/climbing-stairs/JiHyeonSu.py @@ -0,0 +1,21 @@ +# 피보나치 수열 +# DP Bottom-up +# 시간복잡도 및 공간복잡도 O(n) + +class Solution: + def climbStairs(self, n: int) -> int: + if (n < 2): + return n + + dp = [0] * (n + 1) + + dp[1] = 1 + dp[2] = 2 + + first, second = 1, 2 + + for i in range(3, n + 1): + dp[i] = dp[i - 1] + dp[i - 2] + + return dp[n] + From 1f4207a3b8d27295b4949c28b3c67e33a2e687c0 Mon Sep 17 00:00:00 2001 From: Boreum Date: Sat, 12 Apr 2025 21:47:27 +0900 Subject: [PATCH 3/3] add: product-of-array-except-self solved --- product-of-array-except-self/JiHyeonSu.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 product-of-array-except-self/JiHyeonSu.py diff --git a/product-of-array-except-self/JiHyeonSu.py b/product-of-array-except-self/JiHyeonSu.py new file mode 100644 index 000000000..10dfc3955 --- /dev/null +++ b/product-of-array-except-self/JiHyeonSu.py @@ -0,0 +1,17 @@ +class Solution: + def productExceptSelf(self, nums: List[int]) -> List[int]: + n = len(nums) + answer = [1] * n + + left = 1 + for i in range(n): + answer[i] = left + left *= nums[i] + + right = 1 + for i in reversed(range(n)): + answer[i] *= right + right *= nums[i] + + return answer +