🚀 Day 3 of #100DaysOfCode – LeetCode Journey Solved: Running Sum of 1D Array (Java) Today’s focus was on understanding prefix sums and improving array manipulation skills. It’s a simple problem, but it reinforces an important concept used in many advanced algorithms. Small steps every day → Strong foundations over time. Consistency > Motivation. 🔗 GitHub: https://lnkd.in/gd4KSCzz #DSA #Java #LeetCode #ProblemSolving #CodingJourney
Java LeetCode Solution: Running Sum of 1D Array
More Relevant Posts
-
🚀 Day 25 of #100DaysOfCode Solved 24. Swap Nodes in Pairs on LeetCode 🔗🔄 🧠 Key insight: Swapping nodes in a linked list doesn’t require extra memory—careful pointer updates are enough to reverse every adjacent pair. ⚙️ Approach: 🔹Traverse the list two nodes at a time 🔹Reverse links between each adjacent pair 🔹Maintain connections with the previous pair to keep the list intact 🔹Handle edge cases for odd-length lists ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(1) #100DaysOfCode #LeetCode #DSA #LinkedList #Java #ProblemSolving #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
Day 24/50 – LeetCode Solved the Reverse String problem using the two-pointer approach. The solution involves swapping characters from both ends of the array and moving inward until the pointers meet. This ensures an in-place reversal with O(1) extra space and O(n) time complexity. A straightforward problem that reinforces fundamental concepts. #LeetCode #50DaysOfCode #Java #DataStructures
To view or add a comment, sign in
-
-
Day 35/100 – LeetCode Challenge 🚀 Problem: 3Sum Approach: Sorted the array Fixed one element and used two pointers for the remaining two Skipped duplicates to ensure unique triplets Used early stopping when the current number became positive Time Complexity: O(n²) Space Complexity: O(1) Key takeaway: Many 3-element sum problems reduce to sorting + two-pointer pattern. #LeetCode #100DaysOfCode #DSA #Java #TwoPointers #ProblemSolving #InterviewPrep
To view or add a comment, sign in
-
-
Day 12/100 – LeetCode Challenge Problem: Middle of the Linked List Today’s problem focused on finding the middle node of a singly linked list. Approach: Used the Two-Pointer Technique (Slow & Fast pointers). slow moves one step at a time fast moves two steps at a time When fast reaches the end of the list, slow will be at the middle node Complexity: Time: O(n) Space: O(1) Concepts Practiced: Linked List traversal Two-pointer technique Efficient single-pass solution #100DaysOfCode #LeetCode #DSA #Java #LinkedList #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
𝗬𝗼𝘂 𝗵𝗮𝘃𝗲 𝗯𝗲𝗲𝗻 𝘂𝘀𝗶𝗻𝗴 𝗕𝗶𝗻𝗮𝗿𝘆 𝗦𝗲𝗮𝗿𝗰𝗵 𝘄𝗿𝗼𝗻𝗴. It is not just for sorted arrays. The real definition — "Eliminate HALF the search space with each decision." That one shift in thinking unlocks 20+ LeetCode problems. Swipe to see the template, live code, and 7 problems you can now solve with one pattern. 👇 Save this. 🔖 #DSA #BinarySearch #Java #LeetCode #CodingInterview #DebugWithPurpose
To view or add a comment, sign in
-
🚀 Day 42 of #100DaysOfCode 🌱 Topic: Linked List / Two Pointers ✅ Problem Solved: LeetCode 82 – Remove Duplicates from Sorted List II 🛠 Approach: Used a dummy node to simplify handling edge cases where the head might be removed. When two consecutive nodes had the same value, stored that value. Skipped all nodes with that duplicate value using a loop. Linked the previous node to the next distinct node. Continued traversal until reaching the end. This ensures that only unique elements remain in the sorted list. #100DaysOfCode #Day42 #DSA #LinkedList #TwoPointers #LeetCode #Java #ProblemSolving #CodingJourney #Consistency
To view or add a comment, sign in
-
-
𝐐. Why call 𝐓𝐡𝐫𝐞𝐚𝐝.𝐜𝐮𝐫𝐫𝐞𝐧𝐭𝐓𝐡𝐫𝐞𝐚𝐝().𝐢𝐧𝐭𝐞𝐫𝐫𝐮𝐩𝐭() inside a catch block for 𝐈𝐧𝐭𝐞𝐫𝐫𝐮𝐩𝐭𝐞𝐝𝐄𝐱𝐜𝐞𝐩𝐭𝐢𝐨𝐧? 𝐀) To forcefully stop the thread immediately 𝐁) To restore the flag so higher-level code knows the thread was interrupted 𝐂) To throw a new 𝘐𝘯𝘵𝘦𝘳𝘳𝘶𝘱𝘵𝘦𝘥𝘌𝘹𝘤𝘦𝘱𝘵𝘪𝘰𝘯 to the caller Try yourself, if not see answer and explanation in 1st comment. 👀 If you want to understand more about interrupts see 2nd comment. #Java #Multithreading #JavaDeveloper #SoftwareEngineering #CodingInterview
To view or add a comment, sign in
-
Day 9/100 – LeetCode Challenge Problem: 3Sum Today’s challenge was to find all unique triplets in an array whose sum equals 0. Approach: Sort the array to efficiently apply the two-pointer technique. Fix one element nums[i] and use two pointers (left and right) to find the remaining two numbers. If the sum equals 0, store the triplet. Skip duplicate elements to ensure only unique triplets are included. Key Idea: Sorting + Two Pointers helps reduce the brute-force O(n³) approach to O(n²). Concepts Practiced: Sorting Two-pointer technique Duplicate handling Array traversal optimization #100DaysOfCode #LeetCode #DSA #Java #TwoPointers #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 20 – #100DaysOfLeetCode Today’s problem: Product of Array Except Self (Medium) 🔹 Learned how to solve it in O(n) time 🔹 Without using division 🔹 Optimized space complexity The key idea was using prefix and suffix products instead of recalculating product every time. #Day20 #LeetCode #DSA #Java #CodingJourney
To view or add a comment, sign in
-
-
Day 30/100 – LeetCode Challenge 🚀 Problem: Count Binary Substrings Approach: Counted consecutive groups of 0’s and 1’s For every adjacent pair of groups, added min(prevGroup, currGroup) to the result Avoided generating substrings explicitly Time Complexity: O(n) Space Complexity: O(1) Key takeaway: Many substring problems don’t require generating substrings — they can be solved by analyzing group patterns and transitions. #LeetCode #100DaysOfCode #DSA #Java #Strings #ProblemSolving
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