From 2f31db795a07200f5a7b6116d796433a4e79516e Mon Sep 17 00:00:00 2001 From: Seongyul Bae Date: Sat, 29 Nov 2025 14:34:51 +0900 Subject: [PATCH 1/6] 1 solved --- decode-ways/devyulbae.py | 3 +++ .../devyulbae.py | 4 ++++ maximum-subarray/devyulbae.py | 20 +++++++++++++++++++ number-of-1-bits/devyulbae.py | 4 ++++ valid-palindrome/devyulbae.py | 3 +++ 5 files changed, 34 insertions(+) create mode 100644 decode-ways/devyulbae.py create mode 100644 longest-substring-without-repeating-characters/devyulbae.py create mode 100644 maximum-subarray/devyulbae.py create mode 100644 number-of-1-bits/devyulbae.py create mode 100644 valid-palindrome/devyulbae.py diff --git a/decode-ways/devyulbae.py b/decode-ways/devyulbae.py new file mode 100644 index 0000000000..92e25da9a6 --- /dev/null +++ b/decode-ways/devyulbae.py @@ -0,0 +1,3 @@ +class Solution: + def numDecodings(self, s: str) -> int: + diff --git a/longest-substring-without-repeating-characters/devyulbae.py b/longest-substring-without-repeating-characters/devyulbae.py new file mode 100644 index 0000000000..7ae302f312 --- /dev/null +++ b/longest-substring-without-repeating-characters/devyulbae.py @@ -0,0 +1,4 @@ +class Solution: + def lengthOfLongestSubstring(self, s: str) -> int: + + diff --git a/maximum-subarray/devyulbae.py b/maximum-subarray/devyulbae.py new file mode 100644 index 0000000000..d3f5cda001 --- /dev/null +++ b/maximum-subarray/devyulbae.py @@ -0,0 +1,20 @@ +""" +Blind75 - 5. Maximum Subarray +LeetCode Problem Link: https://leetcode.com/problems/maximum-subarray/ + +통과는 했는데 시간복잡도 O(n^2)라서 좀 아쉽다...투포인터로 풀 수도 있을 거 같은데... +""" +from typing import List + +class Solution: + def maxSubArray(self, nums: List[int]) -> int: + max_total = nums[0] + + for s in range(len(nums)): + total = 0 + for e in range(s, len(nums)): + total += nums[e] + if total > max_total: + max_total = total + return max_total + diff --git a/number-of-1-bits/devyulbae.py b/number-of-1-bits/devyulbae.py new file mode 100644 index 0000000000..1d8f174719 --- /dev/null +++ b/number-of-1-bits/devyulbae.py @@ -0,0 +1,4 @@ +class Solution: + def hammingWeight(self, n: int) -> int: + + diff --git a/valid-palindrome/devyulbae.py b/valid-palindrome/devyulbae.py new file mode 100644 index 0000000000..9d60a57235 --- /dev/null +++ b/valid-palindrome/devyulbae.py @@ -0,0 +1,3 @@ +class Solution: + def isPalindrome(self, s: str) -> bool: + From 25f5020c379971cabd9aa87dd1924e8ea5a2f3c2 Mon Sep 17 00:00:00 2001 From: Seongyul Bae Date: Sat, 29 Nov 2025 14:37:34 +0900 Subject: [PATCH 2/6] feature-week3-solved_1 --- valid-palindrome/devyulbae.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/valid-palindrome/devyulbae.py b/valid-palindrome/devyulbae.py index 9d60a57235..a98eadef12 100644 --- a/valid-palindrome/devyulbae.py +++ b/valid-palindrome/devyulbae.py @@ -1,3 +1,3 @@ class Solution: def isPalindrome(self, s: str) -> bool: - + From 7cbe84910691fe4da83e2931b257b558525312e4 Mon Sep 17 00:00:00 2001 From: Seongyul Bae Date: Sat, 29 Nov 2025 14:47:44 +0900 Subject: [PATCH 3/6] feature-solved 2 --- valid-palindrome/devyulbae.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/valid-palindrome/devyulbae.py b/valid-palindrome/devyulbae.py index a98eadef12..e7402cb5c1 100644 --- a/valid-palindrome/devyulbae.py +++ b/valid-palindrome/devyulbae.py @@ -1,3 +1,22 @@ +""" +Blind75 - Valid Palindrome +https://leetcode.com/problems/valid-palindrome/ + +시간복잡도 O(n), 공간복잡도 O(n) + +isalnum() 함수는 시간복잡도 O(1)이므로 필터링하는 과정도 O(n)이다. +[::-1] 슬라이싱도 O(n)이다. +따라서 전체 시간복잡도는 O(n)이다. + + +Runtime Beats +7ms 82.67% + +Memory Beats +23.14 MB 17.23% +""" + class Solution: def isPalindrome(self, s: str) -> bool: - + filtered_s = ''.join(char.lower() for char in s if char.isalnum()) + return filtered_s == filtered_s[::-1] \ No newline at end of file From 43213a1b0c47f7b9a0e3378a857b49799527d288 Mon Sep 17 00:00:00 2001 From: Seongyul Bae Date: Sat, 29 Nov 2025 14:53:47 +0900 Subject: [PATCH 4/6] debug: add indent --- valid-palindrome/devyulbae.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/valid-palindrome/devyulbae.py b/valid-palindrome/devyulbae.py index e7402cb5c1..61f5244db3 100644 --- a/valid-palindrome/devyulbae.py +++ b/valid-palindrome/devyulbae.py @@ -19,4 +19,5 @@ class Solution: def isPalindrome(self, s: str) -> bool: filtered_s = ''.join(char.lower() for char in s if char.isalnum()) - return filtered_s == filtered_s[::-1] \ No newline at end of file + return filtered_s == filtered_s[::-1] + From d459373a0b80b79f0da8a861782669d4663e79d4 Mon Sep 17 00:00:00 2001 From: Seongyul Bae Date: Sat, 29 Nov 2025 15:17:51 +0900 Subject: [PATCH 5/6] feat: solve 3 --- number-of-1-bits/devyulbae.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/number-of-1-bits/devyulbae.py b/number-of-1-bits/devyulbae.py index 1d8f174719..64b0c59bd8 100644 --- a/number-of-1-bits/devyulbae.py +++ b/number-of-1-bits/devyulbae.py @@ -1,4 +1,17 @@ +""" +Blind75 - Number of 1 Bits +https://leetcode.com/problems/number-of-1-bits/ +시간복잡도 : O(log n) +공간복잡도 : O(1) + +풀이 : + 파이썬의 내장함수 bin() -> O(log n) + 문자열 메서드 count() -> O(log n) + +""" + class Solution: def hammingWeight(self, n: int) -> int: - + return str(bin(n)).count('1') + From 72b9c90802b1aa4f1e094b520ae0828b17926a43 Mon Sep 17 00:00:00 2001 From: Seongyul Bae Date: Sat, 29 Nov 2025 15:34:26 +0900 Subject: [PATCH 6/6] feat: solve 4 --- .../devyulbae.py | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/longest-substring-without-repeating-characters/devyulbae.py b/longest-substring-without-repeating-characters/devyulbae.py index 7ae302f312..f0d1181510 100644 --- a/longest-substring-without-repeating-characters/devyulbae.py +++ b/longest-substring-without-repeating-characters/devyulbae.py @@ -1,4 +1,25 @@ +""" +Blind75 - length of longest substring without repeating characters +https://leetcode.com/problems/longest-substring-without-repeating-characters/ +시간복잡도 : O(n) +공간복잡도 : O(min(m, n)) (문자 집합 char_index_map의 크기, 최대는 n = len(s)) +풀이 : 슬라이딩 윈도우 기법을 사용한 문자열 순회 +""" + + class Solution: def lengthOfLongestSubstring(self, s: str) -> int: - + max_count = 0 + start = 0 + char_index_map = {} + + for i, char in enumerate(s): + if char in char_index_map and char_index_map[char] >= start: + start = char_index_map[char] + 1 + char_index_map[char] = i + else: + char_index_map[char] = i + max_count = max(max_count, i - start + 1) + return max_count +