From 9ff742359d158dc410c94df22ea55ea4d9c40062 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Fri, 28 Nov 2025 18:13:28 +0900 Subject: [PATCH 01/11] Week 3: Valid Palindrome --- valid-palindrome/mandel-17.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 valid-palindrome/mandel-17.py diff --git a/valid-palindrome/mandel-17.py b/valid-palindrome/mandel-17.py new file mode 100644 index 0000000000..cf9eb0fdd3 --- /dev/null +++ b/valid-palindrome/mandel-17.py @@ -0,0 +1,4 @@ +class Solution: + def isPalindrome(self, s: str) -> bool: + ch = [c.lower() for c in s if c.isalnum()] + return ch == ch[::-1] From 52e8667b3fa752ecacb41ce3108285c159686b33 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Fri, 28 Nov 2025 22:32:34 +0900 Subject: [PATCH 02/11] Week 3: number-1-bits --- number-of-1-bits/mandel-17.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 number-of-1-bits/mandel-17.py diff --git a/number-of-1-bits/mandel-17.py b/number-of-1-bits/mandel-17.py new file mode 100644 index 0000000000..2430138e22 --- /dev/null +++ b/number-of-1-bits/mandel-17.py @@ -0,0 +1,10 @@ +import collections + +class Solution: + def hammingWeight(self, n: int) -> int: + two_digit = [] + while n >= 1: + two_digit.append(n % 2) + n = n // 2 + cnt_dict = collections.Counter(two_digit) + return cnt_dict[1] From 57a748420c1e54040a9f6e9b3f7e50fdfedfc101 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Fri, 28 Nov 2025 23:18:55 +0900 Subject: [PATCH 03/11] Week 03: combination-sum --- combination-sum/mandel-17.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 combination-sum/mandel-17.py diff --git a/combination-sum/mandel-17.py b/combination-sum/mandel-17.py new file mode 100644 index 0000000000..3117996342 --- /dev/null +++ b/combination-sum/mandel-17.py @@ -0,0 +1,18 @@ +from typing import List + +class Solution: + def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: + result = [] + + def dfs(csum, index, path): + if csum < 0: + return + if csum == 0: + result.append(path) + return + + for i in range(index, len(candidates)): + dfs(csum - candidates[i], i, path + [candidates[i]]) + + dfs(target, 0, []) + return result From 2b300f1a92a7d4b3c0840408cc962e5f02ad2f86 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Fri, 28 Nov 2025 23:20:51 +0900 Subject: [PATCH 04/11] Add new line --- combination-sum/mandel-17.py | 1 + 1 file changed, 1 insertion(+) diff --git a/combination-sum/mandel-17.py b/combination-sum/mandel-17.py index 3117996342..8cc77acd6e 100644 --- a/combination-sum/mandel-17.py +++ b/combination-sum/mandel-17.py @@ -16,3 +16,4 @@ def dfs(csum, index, path): dfs(target, 0, []) return result + \ No newline at end of file From ecc7b71f7a4f29e6344b8aecd3d4dc8c8a7b240c Mon Sep 17 00:00:00 2001 From: sangyoon Date: Fri, 28 Nov 2025 23:21:46 +0900 Subject: [PATCH 05/11] Add new line --- number-of-1-bits/mandel-17.py | 1 + valid-palindrome/mandel-17.py | 1 + 2 files changed, 2 insertions(+) diff --git a/number-of-1-bits/mandel-17.py b/number-of-1-bits/mandel-17.py index 2430138e22..3c2b05442a 100644 --- a/number-of-1-bits/mandel-17.py +++ b/number-of-1-bits/mandel-17.py @@ -8,3 +8,4 @@ def hammingWeight(self, n: int) -> int: n = n // 2 cnt_dict = collections.Counter(two_digit) return cnt_dict[1] + \ No newline at end of file diff --git a/valid-palindrome/mandel-17.py b/valid-palindrome/mandel-17.py index cf9eb0fdd3..ce66130924 100644 --- a/valid-palindrome/mandel-17.py +++ b/valid-palindrome/mandel-17.py @@ -2,3 +2,4 @@ class Solution: def isPalindrome(self, s: str) -> bool: ch = [c.lower() for c in s if c.isalnum()] return ch == ch[::-1] + \ No newline at end of file From b28a667ec2c4c97b0a94d3f4483ad98ca10a4835 Mon Sep 17 00:00:00 2001 From: sangyoon Date: Fri, 28 Nov 2025 23:27:17 +0900 Subject: [PATCH 06/11] Add new line --- combination-sum/mandel-17.py | 2 +- number-of-1-bits/mandel-17.py | 2 +- valid-palindrome/mandel-17.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/combination-sum/mandel-17.py b/combination-sum/mandel-17.py index 8cc77acd6e..8fe45f3d18 100644 --- a/combination-sum/mandel-17.py +++ b/combination-sum/mandel-17.py @@ -16,4 +16,4 @@ def dfs(csum, index, path): dfs(target, 0, []) return result - \ No newline at end of file + \ No newline at end of file diff --git a/number-of-1-bits/mandel-17.py b/number-of-1-bits/mandel-17.py index 3c2b05442a..7d6b47b48e 100644 --- a/number-of-1-bits/mandel-17.py +++ b/number-of-1-bits/mandel-17.py @@ -8,4 +8,4 @@ def hammingWeight(self, n: int) -> int: n = n // 2 cnt_dict = collections.Counter(two_digit) return cnt_dict[1] - \ No newline at end of file + \ No newline at end of file diff --git a/valid-palindrome/mandel-17.py b/valid-palindrome/mandel-17.py index ce66130924..ee69140c9e 100644 --- a/valid-palindrome/mandel-17.py +++ b/valid-palindrome/mandel-17.py @@ -2,4 +2,4 @@ class Solution: def isPalindrome(self, s: str) -> bool: ch = [c.lower() for c in s if c.isalnum()] return ch == ch[::-1] - \ No newline at end of file + \ No newline at end of file From 5b7b7aae12825d747dc7bd79aa206244799856a0 Mon Sep 17 00:00:00 2001 From: mandel <86548085+mandel-17@users.noreply.github.com> Date: Fri, 28 Nov 2025 23:28:05 +0900 Subject: [PATCH 07/11] Update mandel-17.py --- combination-sum/mandel-17.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/combination-sum/mandel-17.py b/combination-sum/mandel-17.py index 8fe45f3d18..7fd2261635 100644 --- a/combination-sum/mandel-17.py +++ b/combination-sum/mandel-17.py @@ -16,4 +16,4 @@ def dfs(csum, index, path): dfs(target, 0, []) return result - \ No newline at end of file + From 4fb9813839d153ecd690137c81854224fd539b2e Mon Sep 17 00:00:00 2001 From: mandel <86548085+mandel-17@users.noreply.github.com> Date: Fri, 28 Nov 2025 23:29:33 +0900 Subject: [PATCH 08/11] Update mandel-17.py From 2bc358c09e46b12added0e597d3e2e9c70af3b04 Mon Sep 17 00:00:00 2001 From: mandel <86548085+mandel-17@users.noreply.github.com> Date: Fri, 28 Nov 2025 23:30:13 +0900 Subject: [PATCH 09/11] Update mandel-17.py --- number-of-1-bits/mandel-17.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/number-of-1-bits/mandel-17.py b/number-of-1-bits/mandel-17.py index 7d6b47b48e..cc0a293f93 100644 --- a/number-of-1-bits/mandel-17.py +++ b/number-of-1-bits/mandel-17.py @@ -8,4 +8,4 @@ def hammingWeight(self, n: int) -> int: n = n // 2 cnt_dict = collections.Counter(two_digit) return cnt_dict[1] - \ No newline at end of file + From 1c2e11fcb6c9de1878d5ca8b41a4c472488404a2 Mon Sep 17 00:00:00 2001 From: mandel <86548085+mandel-17@users.noreply.github.com> Date: Fri, 28 Nov 2025 23:31:36 +0900 Subject: [PATCH 10/11] Update mandel-17.py --- number-of-1-bits/mandel-17.py | 1 - 1 file changed, 1 deletion(-) diff --git a/number-of-1-bits/mandel-17.py b/number-of-1-bits/mandel-17.py index cc0a293f93..2430138e22 100644 --- a/number-of-1-bits/mandel-17.py +++ b/number-of-1-bits/mandel-17.py @@ -8,4 +8,3 @@ def hammingWeight(self, n: int) -> int: n = n // 2 cnt_dict = collections.Counter(two_digit) return cnt_dict[1] - From c538722a802861b6761589caf44d68b971b65519 Mon Sep 17 00:00:00 2001 From: mandel <86548085+mandel-17@users.noreply.github.com> Date: Fri, 28 Nov 2025 23:33:10 +0900 Subject: [PATCH 11/11] Update mandel-17.py --- valid-palindrome/mandel-17.py | 1 - 1 file changed, 1 deletion(-) diff --git a/valid-palindrome/mandel-17.py b/valid-palindrome/mandel-17.py index ee69140c9e..cf9eb0fdd3 100644 --- a/valid-palindrome/mandel-17.py +++ b/valid-palindrome/mandel-17.py @@ -2,4 +2,3 @@ class Solution: def isPalindrome(self, s: str) -> bool: ch = [c.lower() for c in s if c.isalnum()] return ch == ch[::-1] - \ No newline at end of file