🚀 Day 27/100 – LeetCode Challenge ✅ Problem Solved: Remove Duplicates from Sorted Array Today’s problem was a classic example of using the two-pointer technique. The goal was to remove duplicates from a sorted array in-place while maintaining the order of elements. I used two pointers to track unique elements and overwrite duplicates efficiently without using extra space. 💡 Key Learning: Two-pointer technique is very effective for array problems In-place operations help reduce space complexity Understanding problem constraints leads to optimal solutions ⚡ Complexity: Time: O(n) Space: O(1) Consistency is building confidence step by step 🚀 #Day27 #100DaysOfCode #LeetCode #DSA #Cpp #CodingJourney #TwoPointers #ProblemSolving
Remove Duplicates from Sorted Array with Two Pointers
More Relevant Posts
-
Day 29 – LeetCode Journey 🚀 Solved Two Sum II – Input Array Is Sorted using the Two Pointer technique, leveraging the sorted nature of the array for an optimal solution. 🔹 Time Complexity: O(n) 🔹 Runtime: 2 ms (Beats 96.37%) 🔹 Memory Usage: 48.58 MB This problem is a great reminder that recognizing patterns (like sorted arrays) can significantly reduce complexity and improve efficiency. Small optimizations, big impact 📈 Staying consistent and sharpening problem-solving skills every day. #LeetCode #DSA #ProblemSolving #CodingJourney #SoftwareEngineering #Consistency #Learning
To view or add a comment, sign in
-
-
🚀 Day 28/100 – LeetCode Challenge ✅ Problem Solved: Third Maximum Number Today’s problem was about finding the third distinct maximum number in an array. If it doesn’t exist, we return the maximum number instead. I solved this using an optimized approach by tracking the top three distinct values in a single pass without using extra space. 💡 Key Learning: Handling distinct elements is important in many problems Maintaining multiple variables can replace sorting One-pass solutions improve efficiency significantly ⚡ Complexity: Time: O(n) Space: O(1) Consistency is turning effort into progress every day 🚀 #Day28 #100DaysOfCode #LeetCode #DSA #Cpp #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
Day 2/100 of my LeetCode Journey Today I solved “Kth Largest Element in an Array.” Initially, I made a basic mistake. I approached it like a search problem, trying to find a specific value. But this problem is actually about position—finding the kth largest element in sorted order. That small shift in thinking made a big difference. What I learned: The same problem can be solved in multiple ways. Sorting is the simplest. Heaps are more efficient, and quickselect is even more optimized on average. I focused more on understanding why each approach works rather than just coding one solution. Takeaway: Sometimes the main difficulty is not coding, but understanding what the problem is really asking. Still a lot to improve, but making steady progress. Question: Do you usually stick to one approach or try to understand multiple ways to solve the same problem? #Day2 #LeetCode #DSA #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
🚀 Day 21/60 — Learning Step by Step Today I solved Product of Array Except Self (LeetCode #238) Initially, I thought of using division by calculating the total product and dividing each element. But I realized this approach fails with zeros and is not allowed in the problem. 💡 The real learning came from understanding the optimal approach: • Using prefix (left) products • Using suffix (right) products • Combining both to get the result without division • Achieving O(n) time and O(1) extra space This problem strengthened my understanding of how powerful the prefix-suffix pattern is and how constraints guide us toward better solutions. ✨ Key Takeaways: • Avoid shortcuts — they often fail in edge cases • Constraints are hints, not restrictions • Think in terms of “what’s on the left & right” • Space optimization matters Still learning, still improving, one step at a time 🚀 Grateful for the guidance and inspiration from Shiv ram Sharma sir. #DSA #LeetCode #Arrays #PrefixSuffix #ProblemSolving #LearningInPublic #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
At CodingNovas, we see things differently. We don’t have “students”. And we don’t just “teach”. We build industry-ready developers — through a focused training + internship journey where learning meets real execution. From day one, our developers don’t just study concepts… they work on real problems, real systems, and real expectations. And the purpose behind this is clear: 👉 To create the best developers for our own software company 👉 To build a team that understands quality, scalability, and real-world impact The goal is simple: ❌ Not placements ❌ Not certificates ✅ But creating high-value assets who can eventually become part of our team We focus on: ✔ Real-world problem solving ✔ System-level thinking ✔ Industry-level exposure ✔ Performance-driven growth Because in the real world, companies don’t need coders… they need builders who can deliver. — Shiv Ram Sharma Founder & CEO, CodingNovas #CodingNovas #StartupMindset #Developers #Internship #SystemThinking #BuildInPublic
🚀 Day 21/60 — Learning Step by Step Today I solved Product of Array Except Self (LeetCode #238) Initially, I thought of using division by calculating the total product and dividing each element. But I realized this approach fails with zeros and is not allowed in the problem. 💡 The real learning came from understanding the optimal approach: • Using prefix (left) products • Using suffix (right) products • Combining both to get the result without division • Achieving O(n) time and O(1) extra space This problem strengthened my understanding of how powerful the prefix-suffix pattern is and how constraints guide us toward better solutions. ✨ Key Takeaways: • Avoid shortcuts — they often fail in edge cases • Constraints are hints, not restrictions • Think in terms of “what’s on the left & right” • Space optimization matters Still learning, still improving, one step at a time 🚀 Grateful for the guidance and inspiration from Shiv ram Sharma sir. #DSA #LeetCode #Arrays #PrefixSuffix #ProblemSolving #LearningInPublic #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 26/100 – LeetCode Challenge ✅ Problem Solved: Valid Perfect Square Today’s problem was about checking whether a number is a perfect square without using any built-in functions like sqrt. I solved it using Binary Search, which helped efficiently determine whether there exists an integer whose square equals the given number. 💡 Key Learning: Binary Search can be applied beyond arrays Handling large numbers requires careful use of data types Avoiding overflow is important in mathematical problems ⚡ Complexity: Time: O(log n) Space: O(1) Learning to apply fundamentals in different ways every day 🚀 #Day26 #100DaysOfCode #LeetCode #DSA #Cpp #CodingJourney #BinarySearch #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 29/100 – LeetCode Challenge ✅ Problem Solved: Find Peak Element Today’s problem was a great application of Binary Search beyond traditional searching. The goal was to find a peak element — an element greater than its neighbors. Instead of checking every element, I used a binary search approach to efficiently narrow down the search space and find a peak in O(log n) time. 💡 Key Learning: Binary Search can be applied to decision-based problems Observing patterns (increasing/decreasing) helps reduce complexity Not all problems require checking every element ⚡ Complexity: Time: O(log n) Space: O(1) Learning to think smarter, not harder 🚀 #Day29 #100DaysOfCode #LeetCode #DSA #Cpp #CodingJourney #BinarySearch #ProblemSolving
To view or add a comment, sign in
-
-
Most people understand cycle detection… but get stuck when asked to find where the cycle starts. 🚀 Day 19/100 — LeetCode Challenge Solved Linked List Cycle II 💡 Step 1: Detect cycle -Use slow & fast pointers -If they meet → cycle exists 💡 Step 2: Find starting node -Move fast back to head -Move both one step at a time -Where they meet again → start of cycle 👉 This part is pure intuition + math 🧠 Time Complexity: O(n) 💾 Space Complexity: O(1) 💡 What I learned: Detecting a cycle is easy. Finding its starting point is where real understanding begins. This is one of those problems where you either memorize… or truly understand. Have you ever understood why this works? #LeetCode #DSA #100DaysOfCode #Cpp #LinkedList #TwoPointers #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 51 of my LeetCode Journey Solved: Roman to Integer At first glance, this problem looks simple — just map symbols to numbers. But the real catch is handling subtractive cases like IV (4), IX (9), etc. 💡 Key Learning: Instead of blindly adding values, you need to compare current and next characters: If current < next → subtract Else → add This small twist is what separates a correct solution from a wrong one. 📊 Result: ✅ Accepted ⏱️ Runtime: 6 ms 📌 Takeaway: Even “easy” problems test your attention to detail. Don’t underestimate them. Consistency > Motivation. See you on Day 52. #LeetCode #DSA #CodingJourney #ProblemSolving #Consistency
To view or add a comment, sign in
-
Explore related topics
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