Day 115 🚀 | LeetCode Progress Solved 3 problems today 💪 📌 Problem 1: First Bad Version (#278) 👉 Binary search approach ✅ 👉 Efficiently finds the first bad version in O(log n) 👉 Key trick: mid = left + (right - left)/2 to avoid overflow 📌 Problem 2: Set Matrix Zeroes (#73) 👉 Mark rows & columns using boolean arrays 👉 Two-phase approach ensures in-place zeroing 👉 Time: O(m*n), Space: O(m+n) 📌 Problem 3: Reshape the Matrix (#566) 👉 Map original matrix elements to new r x c matrix 👉 Row-wise filling with careful index tracking 👉 Handles invalid reshape by returning original matrix Consistency builds mastery. Every problem solved = step closer to expertise 🚀 #Day115 #LeetCode #DSA #Java #ProblemSolving #CodingJourney #GeekStreak
LeetCode Progress: 3 Problems Solved
More Relevant Posts
-
🚀 𝗗𝗮𝘆 𝟭𝟬 𝗼𝗳 𝟭𝟬𝟬: 𝗦𝗼𝗹𝘃𝗶𝗻𝗴 LeetCode! Today I focused on applying the 𝗣𝗿𝗲𝗳𝗶𝘅 𝗦𝘂𝗺 concept to identify balanced positions in an array. 📌 𝗣𝗿𝗼𝗯𝗹𝗲𝗺𝘀 𝗦𝗼𝗹𝘃𝗲𝗱 𝗧𝗼𝗱𝗮𝘆 (𝗗𝗮𝘆 𝟭𝟬) 🔹 𝗙𝗶𝗻𝗱 𝘁𝗵𝗲 𝗠𝗶𝗱𝗱𝗹𝗲 𝗜𝗻𝗱𝗲𝘅 𝗶𝗻 𝗔𝗿𝗿𝗮𝘆 ✅ Goal: Find an index where the sum of elements on the left is equal to the sum on the right. If multiple exist, return the leftmost one. Approach: Calculated the total sum of the array, then traversed it while maintaining a running left sum. At each index, compared left sum with "(total sum - left sum - current element)" to check if it satisfies the condition, achieving O(n) time complexity. #100DaysOfCode #DSA #LeetCode #Java #ProblemSolving #CodingJourney #PrefixSum #Arrays
To view or add a comment, sign in
-
-
🚀 LeetCode Daily Challenge – Day 30 Today I solved LeetCode 1009 – Complement of Base 10 Integer. 📌 Approach: 1️⃣ Convert the number to binary (conceptually). 2️⃣ Flip all bits (0 → 1 and 1 → 0). 3️⃣ Convert the result back to decimal. Instead of actually converting to binary, we create a mask of all 1s having the same length as n and then use XOR. Example: n = 5 → binary 101 Complement → 010 → decimal 2 📈 Complexity Time: O(log n) Space: O(1) Every problem solved strengthens problem-solving skills and understanding of bit manipulation. #LeetCode #DSA #ProblemSolving #Java #CodingJourney #75DaysOfCode
To view or add a comment, sign in
-
🚀 Day 17 Solved LeetCode 162 – Find Peak Element using Binary Search approach. ⚠️ Interesting Trap: I initially used the common condition while(left <= right), which caused an infinite loop in this problem. When left == right, mid = left, and right = mid doesn't change — so the loop never ends. ✅ Fix: Using while(left < right) ensures the pointers move correctly and the loop terminates. 💡 A small change in the loop condition can make a huge difference in algorithm behavior. ✔️ Time Complexity: O(log n) ✔️ Space Complexity: O(1) Accepted | Runtime: 0ms #Day17 #LeetCode #DSA #BinarySearch #Java #ProblemSolving
To view or add a comment, sign in
-
-
Solved LeetCode #206 — Reverse Linked List. Problem: Given the head of a singly linked list, reverse the list and return the new head. Example: [1,2,3,4,5] → [5,4,3,2,1] Approach Used: Iterative Pointer Reversal Traverse the list while maintaining three pointers: • prev → stores the previous node • head → current node being processed • next → temporarily stores the next node For each node: Store next = head.next Reverse the pointer → head.next = prev Move pointers forward Continue until the list ends. prev becomes the new head of the reversed list. Complexity • Time Complexity: O(n) • Space Complexity: O(1) A classic linked list problem that strengthens pointer manipulation skills. #LeetCode #DSA #Algorithms #Java #CodingInterview #SoftwareEngineering
To view or add a comment, sign in
-
-
Day: 76/365 📌 LeetCode POTD: Maximum Non Negative Product in a Matrix Medium Key takeaways/Learnings from this problem: 1. This problem shows why tracking only max isn’t enough—you need both max and min products because negatives can flip the result. 2. Classic DP twist where each cell depends on top and left, but with sign handling making it interesting. 3. Big takeaway: whenever multiplication + negatives are involved, always think about dual states (min & max). #POTD #365DaysOfCode #DSA #Java #ProblemSolving #LearningInPublic #Consistency 🥷
To view or add a comment, sign in
-
Day 15/100 – LeetCode Challenge Problem: Reverse Linked List Today’s problem focused on reversing a singly linked list using an iterative approach. Approach: Used three pointers to reverse the links: prev → keeps track of the previous node curr → current node being processed next → stores the next node before changing the link Steps: Store curr.next in next Reverse the link → curr.next = prev Move prev and curr one step forward Continue until the list ends. Finally, prev becomes the new head of the reversed list. Complexity: Time: O(n) Space: O(1) Concepts Practiced: Linked List pointer manipulation Iterative reversal technique In-place algorithm #100DaysOfCode #LeetCode #DSA #Java #LinkedList #ProblemSolving #CodingJourney
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 47 / 100 – LeetCode Challenge Solved Remove Nth Node From End of List (Linked List problem). 💡 Key Idea: Used the Two Pointer (Fast & Slow) technique. Move the fast pointer n steps ahead, then move both pointers together until fast reaches the end. This helps identify the node just before the one to remove. ⚡ Result: ✅ Runtime: 0 ms (Beats 100%) ✅ Testcases Passed: 208 / 208 📚 Concepts Practiced: Linked Lists Two Pointer Technique Dummy Node for edge cases Consistency > Perfection. One problem closer to the goal! 💪 #Day47 #100DaysOfCode #LeetCode #DSA #Java #CodingJourney #LinkedList
To view or add a comment, sign in
-
-
🚀 Day 27 of My LeetCode Journey 📌 Problem: Maximum Product of Three Numbers (LeetCode 628) Today’s challenge was to find the maximum product of any three numbers in an integer array. The important observation is that the maximum product can come from: • The three largest numbers, or • The two smallest numbers (negative values) multiplied by the largest number. 🧠 Approach Used: Single Pass (Tracking Maximum & Minimum Values) Instead of sorting the array, we iterate through the array once and keep track of: The three largest numbers The two smallest numbers Finally, we compute the maximum between: 1️⃣ max1 × max2 × max3 2️⃣ min1 × min2 × max1 ⏱ Time Complexity: O(n) 📦 Space Complexity: O(1) This approach avoids sorting and efficiently finds the result in a single traversal of the array. #Day27 #LeetCode #DSA #Java #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
#100DaysOfCode 🚀 👉Solved: LeetCode #16 – 3Sum Closest After solving the classic 3Sum problem earlier, this variation pushed me to think slightly differently. Instead of finding an exact triplet sum equal to 0, this time the goal was to find the sum *closest* to a given target. 🔹 Approach: • Sorted the array • Fixed one element at a time • Applied the Two Pointer technique • Continuously tracked the minimum absolute difference Key Insight: Sometimes optimization problems are not about exact matches, but about minimizing deviation. Time Complexity: O(n²) Space Complexity: O(1) This problem strengthened my understanding of: ✔ Two Pointers ✔ Greedy comparison logic ✔ Edge case handling What I learned: Small variations in problem statements can completely change the thinking approach. Classic 3Sum focuses on exact zero. 3Sum Closest focuses on minimizing |sum - target|. #LearnInPublic #DSA #Java #LeetCode #TwoPointers #ProblemSolving #CodingJourney #SoftwareEngineering
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