🚀 Day 29 of 100 Days of LeetCode 📘 Problem: Combination Sum 💻 Language: Java ✅ Status: Accepted — Runtime ⚡ 2 ms (Beats 86%) Today’s problem was all about backtracking — exploring all possible combinations to reach a target sum. It’s a perfect blend of recursion, decision-making, and pruning unnecessary paths 🧠 ✨ Key Learnings: Backtracking is like exploring a maze — try, backtrack, and try again until you find the exit 🌀 Each recursive call represents a “choice point” — include or skip the element Clean recursion with controlled base cases leads to clarity and precision This problem reminded me how persistence works in both code and life: 💬 “Sometimes, the path to the solution is not straightforward — you just need to keep exploring.” #Day29 #100DaysOfCode #LeetCode #Java #Backtracking #Recursion #DSA #ProblemSolving #CodingJourney #SoftwareDevelopment #KeepLearning #CodeEveryday
Solved Combination Sum with Java and Backtracking
More Relevant Posts
-
🚀 Day 27 of 100 Days of LeetCode 📘 Problem: Generate Parentheses 💻 Language: Java ✅ Status: Accepted — Runtime: ⚡ 0 ms (Beats 100%) Today’s challenge focused on backtracking, one of the most elegant and powerful problem-solving techniques in DSA. The task was to generate all possible valid combinations of parentheses — a perfect test of recursion and logical constraints 🧩 ✨ Key Learnings: Backtracking is about exploring all possibilities, then undoing choices when needed 🔄 Understanding base cases clearly makes recursion much easier Clean recursive structures lead to elegant and efficient solutions This problem reinforced one important principle — 🧠 “Sometimes, going back is the only way to move forward — both in code and in life.” #Day27 #100DaysOfCode #LeetCode #Java #Backtracking #Recursion #ProblemSolving #CodingJourney #DSA #SoftwareDevelopment #KeepLearning #CodeEveryday
To view or add a comment, sign in
-
-
🚀 Day 34 of 100 Days of LeetCode 📘 Problem: Merge Intervals 💻 Language: Java ✅ Status: Accepted — Runtime ⚡ 8 ms (Beats 86%) Today’s challenge was all about mastering interval merging, an essential concept for solving scheduling and range-based problems efficiently 🧩 By sorting intervals and carefully merging overlapping ones, I learned how crucial boundaries and comparisons are — both in coding and in life. ✨ Key Learnings: Sorting simplifies complex interval logic Smart use of conditions avoids unnecessary comparisons Handling edge cases builds precision thinking ⚙️ 💬 “Merge where it makes sense — in code and in life.” #Day34 #100DaysOfCode #LeetCode #Java #DSA #ProblemSolving #Algorithms #CodingJourney #SoftwareDevelopment #KeepLearning #CodeEveryday
To view or add a comment, sign in
-
-
✨ Day 74 of #100DaysOfCode Today, I solved LeetCode 22. Generate Parentheses using Backtracking in Java 🧠💻 📝 Problem Summary: Given n pairs of parentheses, generate all combinations of well-formed parentheses. ✅ Example: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] 💡 Key Idea: Use backtracking to build all valid strings. Keep track of the number of opening and closing brackets. Add '(' if open < n. Add ')' if close < open. When the string reaches length 2 * n, it's a valid combination. 🚀 Learning: Backtracking is a powerful technique for exploring all valid combinations. Keeping proper state (open, close) helps prune invalid paths early. #100DaysOfCode #LeetCode #DSA #Java #ProblemSolving #Backtracking #CodingChallenge #SowmiyaCodes #PlacementPrep
To view or add a comment, sign in
-
-
🌟 Day 93 of #100DaysOfCodingChallenge 🌟 🔹 Problem: 442. Find All Duplicates in an Array 🔹 Platform: LeetCode 🔹 Language: Java 🔹 Difficulty Level: Medium 🧩 Problem Statement: Given an integer array nums containing numbers from 1 to n, find all the elements that appear twice in the array. 💡 Intuition: To identify duplicates efficiently, I used two HashSets — one to store visited elements and another to store duplicates when an element is already seen. This method makes the solution concise and easy to understand while maintaining good performance. ✅ Time Complexity: O(n) ✅ Space Complexity: O(n) 🚀 Key Takeaway: Sometimes, clarity and simplicity in code matter more than optimization — this approach is easy to implement and perfectly suitable for most scenarios. #Day93 #LeetCode #100DaysOfCode #Java #ProblemSolving #CodingChallenge #DSA #LearnByCoding #WomenInTech
To view or add a comment, sign in
-
-
🌟 Day 86 of #100DaysOfCodingChallenge 🌟 🚀 Problem: 561. Array Partition 💻 Language: Java Today’s challenge was about maximizing the sum of the minimum values in n pairs formed from an array of 2n integers. 🧩 Approach: 1️⃣ Sort the array in ascending order. 2️⃣ Take every alternate element (starting from index 0). 3️⃣ Add them up — this gives the maximum possible sum of mins in all pairs. 🧠 Key Insight: When the array is sorted, pairing adjacent elements ensures the smallest numbers are always matched optimally, leading to the maximum possible result. 📊 Example: Input → [1,4,3,2] Sorted → [1,2,3,4] Pairs → (1,2), (3,4) Output → 4 ✅ ✨ Learning: Sometimes the simplest approach — sorting and selecting — can yield the most optimal result! #Day86 #LeetCode #Java #100DaysOfCode #CodingChallenge #ProblemSolving #ArrayPartition #DSA #WomenInTech #SathyabamaUniversity
To view or add a comment, sign in
-
-
#Day45 of #50DaysOfCoding Divisible Sum Pairs Problem (Java) Today, I tackled the “Divisible Sum Pairs” problem from HackerRank using Java. The objective was to identify all pairs of numbers in a list whose sum is divisible by a specified integer k. Concepts Used: - Nested loops to check every unique pair (i, j) where i < j. - Modulo operation to verify divisibility: (ar[i] + ar[j]) % k == 0. - Basic iteration and condition checking logic. Working: - Read input values n, k, and the array ar. - Iterate through all pairs. - Count how many pairs have sums divisible by k. - Print the total count. Example: If n = 6, k = 3, and ar = [1, 3, 2, 6, 1, 2], the valid pairs are (1,2), (3,6), (2,4), etc. Output: 5 Complexity: - Time Complexity: O(n²) - Space Complexity: O(1) This exercise enhanced my understanding of modulo operations, loops, and pair iteration logic — essential concepts for many coding interviews. #Java #ProblemSolving #CodingJourney #Programming #LearningEveryday #LogicBuilding #leetcode #DSA #CodingChallenge #LearnJava #CodeNewbie #Algorithms #DataStructures #TechJourney #javaProgramming #LearningInPublic #PentagonSpace
To view or add a comment, sign in
-
-
If you’re learning #Java, you’ve probably seen the keywords #static and wondered — what’s the difference between static and non-static methods? 🤔 Let’s break it down 👇 🧩 Static Methods - Belong to the #class, not to any specific object. - Can be called without creating an #object. - Commonly used for utility or helper functions. ⚙️ Non-Static Methods -Belong to objects created from the class. -Need an instance to be called. -Can access both static and non-static members of the class. 🔑 Key takeaway: -Use 'static' when behavior doesn’t depend on 'object' data. Use 'non-static' when the method works with 'instance' variables. 💬 What’s one thing about static that confused you when you first started learning Java? Let’s discuss in the comments 👇 #Java #LearnJava #CodingForBeginners #SoftwareDevelopment #ProgrammingTips #JavaDeveloper #CodeNewbie #TechEducation
To view or add a comment, sign in
-
-
🚀 Day 23 of 100 Days of LeetCode 📘 Problem: Reverse Integer 💻 Language: Java ✅ Status: Accepted (Runtime: 1 ms ⚡ — Beats 81.9%) Today’s challenge focused on reversing digits of an integer while handling overflow cases carefully. It was a great reminder that even simple-looking problems test your precision and edge-case thinking. ✨ Key Takeaways: Integer limits can silently cause overflow errors 🧮 Learned how to handle Integer.MIN_VALUE and MAX_VALUE properly Small logic tweaks can make or break your runtime Every accepted submission adds a new layer of understanding 💪 #Day23 #100DaysOfCode #LeetCode #Java #ProblemSolving #CodingJourney #SoftwareDevelopment #DSA #KeepLearning #CodeEveryday
To view or add a comment, sign in
-
-
🚀 Day 26 of 100 Days of LeetCode 📘 Problem: Search a 2D Matrix 💻 Language: Java ✅ Status: Accepted — Runtime: ⚡ 0 ms (Beats 100%) Today’s problem focused on searching efficiently within a 2D matrix — a great exercise for understanding nested loops, traversal logic, and time optimization. While this version used a simple brute-force approach, it served as a good refresher on matrix iteration patterns before moving on to more optimized binary search techniques in 2D grids. ✨ Key Learnings: Matrix traversal can be intuitive when visualized 🔢 Always consider both brute-force and optimized approaches — understanding both is key to depth of knowledge Writing clean, readable code matters as much as optimizing it Each problem solved is another small brick in the foundation of strong problem-solving skills 💪 #Day26 #100DaysOfCode #LeetCode #Java #ProblemSolving #DSA #CodingJourney #SoftwareDevelopment #Matrix #KeepLearning #CodeEveryday
To view or add a comment, sign in
-
-
💻 Day 45 of #LeetCode Journey 🚀 ✅ Problem: Count and Say 📘 Language: Java 🔹 Status: Accepted (30/30 test cases passed) 🔹 Runtime: 4 ms | Beats 55.38% 🔹 Memory: 41.86 MB 🧠 Concept: This problem is about generating the n-th term in the “count and say” sequence. Each term is built by describing the previous term — count the number of digits and say them in order. 🧩 Approach: Start with "1". For each iteration, use a StringBuilder to construct the next sequence. Track consecutive digits using a counter. Append the count and digit when the sequence changes. 💡 Efficient string manipulation and iteration give optimal performance. 🔥 Every solved problem builds confidence. One step closer to mastering patterns in strings! #Day45 #LeetCode #Java #CodingChallenge #ProblemSolving #CountAndSay #50DaysOfCode
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development