Day 32 of #100DaysOfCode 🚀 Today’s LeetCode lesson wasn’t about algorithms — it was about reading errors carefully. 🔍 Problem: Minimum Removals to Balance Array 💡 Approach: Sorting + Sliding Window (Two Pointers) But I hit a Runtime Error even though my logic was correct. Takeaways: Always match the exact function name expected by the platform Don’t panic on runtime errors — read the driver message carefully Logic can be perfect, but naming matters 🧠 Final solution uses: Sorting Two pointers O(n log n) time complexity Consistency > Speed. Small details > Big mistakes. On to the next problem 💪 #100DaysOfCode #LeetCode #Python #DSA #ProblemSolving #CodingJourney #LearningByDoing
Lessons from LeetCode: Reading Errors & Naming Conventions
More Relevant Posts
-
Day 42 ✅ | Reverse Linked List Revisited one of the most important linked list problems today. The goal is to reverse the list in-place by carefully adjusting node pointers. Key ideas used: Maintain prev and curr pointers Temporarily store the next node Reverse links step by step while traversing the list This problem is a great reminder that mastering the basics makes harder problems much easier 💪 #Python #LeetCode #LinkedList #ReverseLinkedList #ProblemSolving #Day42 #CodingJourney #DSA #Algorithms #DataStructures
To view or add a comment, sign in
-
-
Day 96 – LeetCode Journey Another step forward in consistency and problem-solving discipline. Today’s problem: Find the Distance Value Between Two Arrays Key learning: Understanding “there is NOT ANY element…” type conditions. Using nested loops with proper break logic. Leveraging Python’s for-else construct effectively. Strengthening brute-force reasoning before optimization. Result: ✅ 103 / 103 test cases passed ⚡ Runtime: 47 ms 💾 Memory efficiency: Strong performance Every day isn’t about solving the hardest problem — it’s about sharpening logic and avoiding small mistakes. Consistency > Intensity. #Day96 #LeetCode #ProblemSolving #Python #DSA #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
LeetCode | Linked List Cycle II 🔗 Once fast and slow meet, resetting one pointer to head reveals the cycle entry point 🔹 Approach: Floyd’s Cycle Detection 🔹 Key idea: After collision, move one pointer to head to find cycle start 🔹 Time Complexity: O(n) 🔹 Space Complexity: O(1) Daily DSA practice to strengthen linked list skills 🚀 #LeetCode #DSA #LinkedList #TwoPointers #Python #CodingJourney #LearningInPublic
To view or add a comment, sign in
-
LeetCode 3289 (The Two Sneaky Numbers of Digitville) Achieved a 0 ms runtime (Beats 100.00%) using a precise single-pass discovery approach! The goal is to find two numbers that appear twice in a list where everyone else appears once. I iterated through the numbers exactly once, tracking "seen" values.The moment a number is encountered again, it’s identified as "sneaky" and added to the results.By using simple, direct list interactions in Python, the solution hits the performance floor with no wasted cycles. #LeetCode #Python #Algorithms #Optimization #CleanCode #SoftwareEngineering #DSA
To view or add a comment, sign in
-
-
🚀 Day 13 of #100DaysOfLeetCode 📌 Problem Solved: Container With Most Water 🧠 Topic: Two Pointers Approach: Placed two pointers at both ends of the array Calculated area using: area = (right - left) * min(height[left], height[right]) Moved the pointer with the smaller height inward Tracked the maximum area during each step ⏱ Time Complexity: O(n) 💾 Space Complexity: O(1) ✨ What I learned today: Instead of checking every possible pair (O(n²)), using two pointers reduces the solution to O(n). The key insight: the smaller height always limits the area. #Day12 #100daysofLeetCode #DSA #Python #TwoPointers #Arrays #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Solved an interesting array problem using prefix sums + hash maps 🚀 This solution efficiently finds the longest subarray based on a comparison condition (arr[i] > k) by converting the problem into a prefix sum balance and tracking first occurrences with a hashmap. ✅ O(n) time complexity ✅ Smart use of prefix sums ✅ Great example of turning a complex condition into a simple math problem Always fun when problem-solving meets optimization! 💻📊 #Python #DataStructures #Algorithms #CodingInterview #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 39 of #100DaysOfCode Solved Add Binary today! Problem: Given two binary strings, return their sum as a binary string. At first glance, it looks simple — but the key is handling: ✔ Carry correctly ✔ Different string lengths ✔ Edge case when carry remains at the end Instead of converting to integers, I implemented the manual binary addition approach (right to left with carry). This ensures the solution works efficiently even for very large inputs. 🧠 Key Learning: Sometimes the best solution is to simulate the real-world process (just like how we do pen-and-paper addition). ⏱ Time Complexity: O(n) 📦 Space Complexity: O(n) Consistency > Motivation 💪 On to Day 40 🔥 #Day39 #LeetCode #Binary #ProblemSolving #CodingJourney #Python #DSA
To view or add a comment, sign in
-
-
Day 7/100 – #100DaysOfCode 🚀 Solved LeetCode #27 – Remove Element (Python). Today I practiced the Two Pointer technique to remove all occurrences of a given value in-place and return the new length of the array. Approach: 1) Initialize a pointer k to track the position of valid elements. 2) Traverse the array using index i. 3) If nums[i] is not equal to the given value, assign it to nums[k]. 4) Increment k to expand the valid portion of the array. 5) Return k as the new length. Time Complexity: O(n) Space Complexity: O(1) – In-place solution Learning how in-place array manipulation works step by step 💪 #LeetCode #Python #DSA #Arrays #TwoPointers #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