🚀 Day 50 of #100DaysOfCode Solved LeetCode Problem #1458 – Max Dot Product of Two Subsequences ✅ This problem focused on finding the maximum dot product between non-empty subsequences of two arrays. The tricky part was handling negative values and ensuring at least one pair is always chosen. Key Learnings: -> Used Dynamic Programming with memoization to avoid recomputation -> Carefully handled the base case using Integer.MIN_VALUE to enforce non-empty subsequences -> Explored the classic include vs exclude decision at each index -> Strengthened understanding of DP on two sequences Language Used: Java -> Runtime: 11 ms (Beats 59.26%) -> Memory: 48.77 MB Step by step, sharpening DP intuition and edge-case handling 🚀 #LeetCode #DynamicProgramming #Java #ProblemSolving #100DaysOfCode
Max Dot Product of Two Subsequences in Java
More Relevant Posts
-
🚀 Day 52 of #100DaysOfCode Solved LeetCode Problem #712 – Minimum ASCII Delete Sum for Two Strings. This problem focused on minimizing the total ASCII value of deleted characters to make two strings equal. A classic dynamic programming challenge that required carefully defining states and transitions for optimal substructure. Key Learnings: -> Modeled the problem using DP on string indices -> Handled base cases when one string is fully consumed -> Used memoization to avoid overlapping subproblems Strengthened understanding of string DP and cost-based optimization Language Used: Java -> Runtime: 34 ms (Beats 7.60%) -> Memory: 50.39 MB Consistent practice, deeper DP intuition, and steady progress 🚀 #LeetCode #DynamicProgramming #Java #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 67 of #100DaysOfCode Solved LeetCode Problem #1984 – Minimum Difference Between Highest and Lowest of K Scores ✅ This problem focused on minimizing the score gap by smartly selecting k elements after sorting the array. A perfect example of how sorting + sliding window logic can turn a problem simple and efficient. Key Learnings: -> Sorting simplifies comparisons -> Sliding window to evaluate consecutive groups of size k -> Avoid brute force by leveraging order -> Small observations lead to clean solutions Language Used: Java -> Runtime: 8 ms (Beats 89.22%) -> Memory: 47.09 MB (Beats 25.34%) Consistency > Intensity 💪 On to the next challenge 🚀 #LeetCode #Java #ProblemSolving #Algorithms #Sorting #SlidingWindow #100DaysOfCode
To view or add a comment, sign in
-
-
LeetCode Daily — Problem #3794: Reverse String Prefix Today’s challenge was a fun string manipulation task: Problem: Given a string s and an integer k, reverse the first k characters and return the resulting string. Example: Input: s = "abcd", k = 2 Output: "bacd" Approach: I converted the string to a character array, reversed the first k characters using a loop, and then appended the rest. Here's the Java solution:✅ Result: Accepted with 0 ms runtime! Takeaway: This problem reinforced how simple logic and clean iteration can solve string-based challenges efficiently. It’s a great reminder that even “Easy” problems can sharpen your fundamentals. #LeetCode #Java #StringManipulation #CodingChallenge #100DaysOfCode #ProblemSolving #LinkedInLearning
To view or add a comment, sign in
-
-
day 92/100 #leetcodegrinding The number of rotations equals the index of the minimum element in the array. Using binary search, we can find this efficiently in O(log n) time. 🧠 What I focused on: Identifying the pivot (minimum element) Handling rotated vs non-rotated cases Applying binary search with correct boundaries Writing a clean and efficient Java solution This problem really strengthens understanding of rotated arrays and search logic. Keeping the streak alive 🚀 #DSA #ProblemSolving #Java #BinarySearch #Arrays #LeetCode #CodingPractice #DailyLearning
To view or add a comment, sign in
-
-
Finished working through Arrays & ArrayLists today. This module felt like the point where coding stopped being about Java syntax and started being about how to think. What arrays actually taught me: - indices matter more than the values themselves - in-place operations need careful planning - small boundary mistakes break logic completely - many problems are solved by reusing a few core patterns - breaking a problem into steps makes it manageable - optimization only makes sense after correctness Working with ArrayLists alongside arrays also made the trade-offs clearer — convenience vs control. Problems like rotation, sorting with pointers, and finding missing elements forced me to slow down and reason instead of guessing. This module made me more comfortable with problem-solving and showed me where I still need practice. Moving forward with a better foundation. #Java #DSA #Arrays #LearningInPublic #ProblemSolving #CodingJourney #JavaDeveloper
To view or add a comment, sign in
-
50 lines of code vs. 1 line. Who wins? 🥊 If you’re still writing getters, setters, constructors, and toString methods manually in 2026, you are working too hard. Java Records changed the game by killing "Boilerplate Hell." It turns a massive, messy POJO into a single, elegant line of code. In my latest blog post, I break down: ✅ Why "Data as Data" is better than "Data as Behavior." ✅ The "Freebies" you get from the compiler. ✅ Real-world scenarios where Records shine. Read the full breakdown here: 👇 https://lnkd.in/gUkyPU8c #Java #CleanCode #SoftwareEngineering #BackendDevelopment #JavaRecords #ProgrammingTips
To view or add a comment, sign in
-
-
Day25 - LeetCode Journey Solved LeetCode 344: Reverse String in Java ✅ This was a simple problem on the surface, but it perfectly highlights how powerful clean logic can be. The goal was to reverse a string in-place using O(1) extra space, which means no extra arrays and no shortcuts. Just pure two-pointer logic. Using the left and right pointers and swapping characters step by step felt very satisfying. It’s one of those patterns that looks small but appears everywhere in interviews and real-world problems. Mastering this makes many string and array problems much easier later on. What I liked about this problem is how it teaches efficiency. Instead of creating new memory, we directly modify the existing array. That mindset of optimizing space is extremely important in DSA. Key takeaways: • Strong practice of the two-pointer technique • In-place operations with constant extra space • Clean and readable swapping logic • Reinforced fundamentals of string manipulation ✅ Accepted successfully ✅ 0 ms runtime with optimal performance Sometimes the simplest problems build the strongest foundations. Consistency with basics is what makes complex problems feel easier later 💪 #LeetCode #DSA #Java #Strings #ProblemSolving #Algorithms #CodingJourney #InterviewPreparation #TwoPointers #Consistency #DailyPractice
To view or add a comment, sign in
-
-
DSA journey 🚀 📌 LeetCode #977 – Squares of a Sorted Array 💻 Language: Java 🔹 Approach (Two Pointer Technique): Initialize two pointers at the start and end of the array Compare squares of both ends Place the larger square at the end of the result array Move pointers inward accordingly Continue until all elements are processed This works because the array is already sorted, but negative numbers can produce larger squares 💡 ⏱ Time Complexity: O(n) 🧩 Space Complexity: O(n) Efficient and elegant ✨ Consistency over perfection 💯 #DSA #Java #LeetCode #ProblemSolving #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 72 of #100DaysOfCode Solved LeetCode Problem #2977 – Minimum Cost to Convert String II ✅ This was a more advanced follow-up that required handling string-level transformations efficiently. The challenge was to minimize the total cost by choosing optimal substring conversions rather than single-character changes. Key Learnings: -> Using a Trie to store and index valid string transformations -> Modeling transformation costs with dynamic programming -> Combining Trie traversal + DP for efficient substring matching -> Carefully managing state transitions to avoid unnecessary recomputation Language Used: Java -> Runtime: 209 ms (Beats 34.88%) -> Memory: 48.68 MB (Beats 18.60%) Step by step, leveling up problem-solving depth and string algorithm intuition 🚀 #LeetCode #DynamicProgramming #Trie #Java #ProblemSolving #100DaysOfCode
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