DevLog Day 45 Today was a revisit day. Sometimes you need to go back to the basics and there is nothing wrong with that. The problem was Remove Element. You are given an array and a value, and you need to remove all occurrences of that value in place and return the length of the resulting array. No extra space, just you and the array. It is one of those problems that looks almost too simple on the surface but it is a great exercise in thinking about in place operations and pointer manipulation. Going back to a problem you have already seen hits differently the second time around because you start noticing the patterns you missed before and connecting them to harder problems you have solved since. #100DaysOfCode #LeetCode #NeetCode #DataStructures #Arrays #CodingJourney #ProblemSolving #Programming #SoftwareEngineering #Tech
Remove Element in Place with LeetCode
More Relevant Posts
-
DevLog Day 46 Today I finally conquered a problem that had beaten me before. Redemption days hit different. The problem was Sort Colors on LeetCode, a medium level question where you are given an array containing only 0s, 1s, and 2s representing colors, and you need to sort it in place in a single pass. No built in sort, no multiple iterations. The brute force is straightforward, you could use a built in sort function or classic algorithms like bubble sort or insertion sort, but the single pass constraint rules all of that out. My solution used counting sort. Since we only ever have three possible values, I used a fixed size array to count the frequency of 0s, 1s, and 2s, then overwrote the original array using those counts. Because the frequency array never grows beyond 3 elements regardless of input size, the space stays constant. There is something satisfying about coming back to a problem that once stumped you and seeing it clearly this time. It is proof that the reps are adding up even when it does not feel like it in the moment. #100DaysOfCode #LeetCode #NeetCode #DataStructures #Arrays #CodingJourney #ProblemSolving #Programming #SoftwareEngineering #Tech
To view or add a comment, sign in
-
DevLog Day 44 Today I solved one of the trickiest problems I have come across so far. My brain is still hurting but here we are. The problem was Permutation in String. You are given two strings s1 and s2 and you need to check if any permutation of s1 exists as a substring inside s2. Simple to read, painful to solve. I worked through both a brute force and an optimized approach. The brute force sorts every window of s2 and compares it against the sorted s1, which works but costs O(n²) time. The optimized approach swaps sorting for a hashmap that tracks letter frequencies across a sliding window, which is faster in practice but honestly just as tricky to wrap your head around when you are seeing it for the first time. The best solution goes even further with a pure sliding window that avoids nested loops entirely. I will be honest, I do not fully understand the logic behind it yet and I know I will need to revisit this one a few times. But that is fine. Some problems are not meant to click on the first try and I know this one will teach me something deeper about sliding windows once it does. #100DaysOfCode #LeetCode #NeetCode #DataStructures #SlidingWindow #CodingJourney #ProblemSolving #Programming #SoftwareEngineering #Tech
To view or add a comment, sign in
-
Day 56 of solving LeetCode. Today’s problem: Count Primes Result: Accepted ✔️ (66/66 test cases) Performance: • Runtime: 96 ms (beats 75.25%) • Memory: 51.26 MB Key takeaway: Brute force thinking doesn’t scale. The real shift is recognizing patterns like the Sieve of Eratosthenes — precompute smartly instead of checking repeatedly. Most people stay stuck trying to optimize loops. The smarter move is changing the approach entirely. Consistency > motivation. 56 days in. No breaks. No excuses. ∆ #LeetCode #CodingJourney #DSA #Programming #ProblemSolving #100DaysOfCode #DeveloperLife #CodingDaily #Algorithms #Consistency #GrowthMindset
To view or add a comment, sign in
-
-
55 of #100DaysOfCode: Today I dived into LeetCode 316 (Remove Duplicate Letters). This problem is a fantastic lesson in balancing multiple constraints: maintaining unique characters while ensuring the smallest lexicographical order. The Key Insight: Using a Monotonic Stack approach. The goal isn't just to remove duplicates, but to greedily decide whether to keep a character or pop it based on whether it appears again later in the string. Stack Logic: Pop elements only if they are larger than the current character AND guaranteed to appear later. #cpp #leetcode #programming #algorithms #datastructures #codingcommunity #100daysofcode
To view or add a comment, sign in
-
-
In LeetCode 867 – Transpose Matrix Today I worked on a basic but important matrix problem: transposing a matrix. The idea is simple — convert rows into columns. Understanding matrix traversal helps build a strong foundation for more complex problems. #LeetCode #DSA #Coding #Programming #ProblemSolving #100DaysOfCode #DeveloperJourney #CodeNewbie #Tech #Learning #CodingLife #ComputerScience #Algorithms #Matrix #Consistency
To view or add a comment, sign in
-
-
Day 70 of #100DaysOfCode 💻 Solved LeetCode 523 – Continuous Subarray Sum using an optimized Prefix Sum + HashMap approach. 💡 Key Insight: If two prefix sums have the same remainder when divided by k, the subarray between them is divisible by k. ⚡ Reduced time complexity from O(n²) → O(n) #leetcode #coding #dsa #cpp #programming #placements
To view or add a comment, sign in
-
-
🚀 Day 4 — Code Once - Scale Everywhere. Functions aren't just a technical necessity—they are the architects of efficiency. By breaking down complex systems into reusable pieces, we move from "fixing code" to "scaling impact." Functions don't just organize your code—they organize your thinking. 💡 #Datascience #CleanCode #Programming #TechInsights #Efficiency
To view or add a comment, sign in
-
-
51 of #100DaysOfCode Solved LeetCode 739 — Daily Temperatures using the Monotonic Stack approach 🔥 💡 Approach: Instead of checking every future day (which would be inefficient), I used a stack to store indices of temperatures in decreasing order. Traverse the array If the current temperature is higher than the one at the stack’s top, we’ve found the next warmer day Pop the index and calculate the difference Push the current index into the stack This ensures each element is processed only once — making it super efficient ⚡ ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) #leetcode #coding #dsa #cpp #programming #developers #tech #interviewprep
To view or add a comment, sign in
-
-
@Every team struggles with naming. Not because developers don’t know better but because consistency is harder than it looks. We mix: Get / Fetch / Retrieve Processor / Handler / Service And slowly, the codebase becomes harder to read. The fix is simple: Use one word per concept. Consistency reduces cognitive load. And cognitive load is what slows teams down. Clean code is not about rules. It’s about clarity. #CleanCode #SoftwareEngineering #DotNet #BackendDevelopment #CodeQuality #TechLeadership #Programming
To view or add a comment, sign in
-
-
Binary tree right side view Approach: - Keep a level variable - If level == result.size(), add current node (first node of that level) - Traverse right first, then left Time: O(n) Space: O(h) (worst: O(n), best: O(log n)) #Algorithms #DSA #LeetCode #coding #Programming
To view or add a comment, sign in
-
More from this author
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