From f031aa811fe50be09301036e59b8c7b0d4ac31e7 Mon Sep 17 00:00:00 2001 From: xeulbn Date: Fri, 10 Jul 2026 17:10:48 +0900 Subject: [PATCH 1/3] Solve Week 03 --- combination-sum/xeulbn.java | 30 ++++++++++++++++++++++++++++++ decode-ways/xeulbn.java | 29 +++++++++++++++++++++++++++++ maximum-subarray/xeulbn.java | 30 ++++++++++++++++++++++++++++++ number-of-1-bits/xeulbn.java | 17 +++++++++++++++++ valid-palindrome/xeulbn.java | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 138 insertions(+) create mode 100644 combination-sum/xeulbn.java create mode 100644 decode-ways/xeulbn.java create mode 100644 maximum-subarray/xeulbn.java create mode 100644 number-of-1-bits/xeulbn.java create mode 100644 valid-palindrome/xeulbn.java diff --git a/combination-sum/xeulbn.java b/combination-sum/xeulbn.java new file mode 100644 index 0000000000..03c7992f12 --- /dev/null +++ b/combination-sum/xeulbn.java @@ -0,0 +1,30 @@ +import java.util.*; + +class Solution { + public List> combinationSum(int[] candidates, int target) { + List> result = new ArrayList<>(); + + backtrack(candidates, target, 0, new ArrayList<>(), result); + + return result; + } + + private void backtrack(int[] candidates, int remain, int start, List current, List> result) { + if (remain == 0) { + result.add(new ArrayList<>(current)); + return; + } + + if (remain < 0) { + return; + } + + for (int i=start; i= 10 && twoDigit <= 26) { + dp[i] += dp[i - 2]; + } + } + + return dp[n]; + } +} diff --git a/maximum-subarray/xeulbn.java b/maximum-subarray/xeulbn.java new file mode 100644 index 0000000000..129de29a87 --- /dev/null +++ b/maximum-subarray/xeulbn.java @@ -0,0 +1,30 @@ +import java.util.*; + +class Solution { + public int maxSubArray(int[] nums) { + int currentSum = nums[0]; + int maxSum = nums[0]; + + int currentStart = 0; + int maxStart = 0; + int maxEnd = 0; + + for (int i=1; i currentSum + nums[i]) { + currentSum = nums[i]; + currentStart = i; + } else { + currentSum += nums[i]; + } + + if (currentSum > maxSum) { + maxSum = currentSum; + maxStart = currentStart; + maxEnd = i; + } + } + + return maxSum; + + } +} diff --git a/number-of-1-bits/xeulbn.java b/number-of-1-bits/xeulbn.java new file mode 100644 index 0000000000..75cafca464 --- /dev/null +++ b/number-of-1-bits/xeulbn.java @@ -0,0 +1,17 @@ +import java.util.*; + +class Solution { + public int hammingWeight(int n) { + int count = 0; + + while (n > 0) { + if ((n & 1) == 1) { + count++; + } + + n = n >> 1; + } + + return count; + } +} diff --git a/valid-palindrome/xeulbn.java b/valid-palindrome/xeulbn.java new file mode 100644 index 0000000000..7feed164bf --- /dev/null +++ b/valid-palindrome/xeulbn.java @@ -0,0 +1,32 @@ +import java.util.*; + +class Solution { + public boolean isPalindrome(String s) { + int left =0; + int right = s.length()-1; + + while (left < right) { + + while (left < right && !Character.isLetterOrDigit(s.charAt(left))) { + left++; + } + + while (left < right && !Character.isLetterOrDigit(s.charAt(right))) { + right--; + } + + char leftChar = Character.toLowerCase(s.charAt(left)); + char rightChar = Character.toLowerCase(s.charAt(right)); + + if (leftChar != rightChar) { + return false; + } + + left++; + right--; + } + + + return true; + } +} From de03f8ed480d6ea19e8bd5d6010dacc987966766 Mon Sep 17 00:00:00 2001 From: xeulbn Date: Tue, 14 Jul 2026 10:32:17 +0900 Subject: [PATCH 2/3] fix: unnecessary variable delete --- leetcode-study.iml | 85 ++++++++++++++++++++++++++++++++++++ maximum-subarray/xeulbn.java | 9 ---- 2 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 leetcode-study.iml diff --git a/leetcode-study.iml b/leetcode-study.iml new file mode 100644 index 0000000000..5ea48dee00 --- /dev/null +++ b/leetcode-study.iml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/maximum-subarray/xeulbn.java b/maximum-subarray/xeulbn.java index 129de29a87..b4d2f0a77d 100644 --- a/maximum-subarray/xeulbn.java +++ b/maximum-subarray/xeulbn.java @@ -5,26 +5,17 @@ public int maxSubArray(int[] nums) { int currentSum = nums[0]; int maxSum = nums[0]; - int currentStart = 0; - int maxStart = 0; - int maxEnd = 0; - for (int i=1; i currentSum + nums[i]) { currentSum = nums[i]; - currentStart = i; } else { currentSum += nums[i]; } if (currentSum > maxSum) { maxSum = currentSum; - maxStart = currentStart; - maxEnd = i; } } - return maxSum; - } } From bdc95b03d943467e4827b8eb52a23cb3bd904952 Mon Sep 17 00:00:00 2001 From: xeulbn Date: Tue, 14 Jul 2026 10:33:59 +0900 Subject: [PATCH 3/3] chore: remove IntelliJ project file --- leetcode-study.iml | 85 ---------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 leetcode-study.iml diff --git a/leetcode-study.iml b/leetcode-study.iml deleted file mode 100644 index 5ea48dee00..0000000000 --- a/leetcode-study.iml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file