🚀 Day 11 of #100DaysOfCode Solved LeetCode Problem #27 – Remove Element today! 💻 🔹 Approach: Used the Two Pointer Technique One pointer (i) iterates through the array Another pointer (ptr) keeps track of valid elements If nums[i] != val, assign it to nums[ptr] and increment ptr 🔹 Time Complexity: O(n) 🔹 Space Complexity: O(1) 💡 Key Learning: In-place array modification using two pointers helps optimize space and improves efficiency. 📌 Consistency is the key — one step closer every day! #LeetCode #DSA #Java #CodingJourney #Day11 #100DaysOfCode
LeetCode #27: Remove Element with Two Pointer Technique
More Relevant Posts
-
100 Days of Code Day - 24 🔁 Swap Nodes in Pairs – LeetCode Problem Solved a classic Linked List problem today! 💡 👉 Given a linked list, swap every two adjacent nodes without modifying values — only changing the links. ✅ Example: Input: [1,2,3,4] Output: [2,1,4,3] 💭 Approach: Used a dummy node and pointer manipulation to efficiently swap nodes in O(n) time and O(1) space. 📌 Key Learning: Understanding pointer handling is crucial for mastering Linked Lists. #LeetCode #Java #DSA #LinkedList #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
Day 78 of #LeetCode 🚀 Solved: Number of Steps to Reduce a Number to Zero Today’s problem was simple but a great reminder of how important basic logic and loops are. 💡 Key Idea: If number is even → divide by 2 If odd → subtract 1 Repeat until it becomes 0 📌 Focus: Strengthening fundamentals Writing clean and efficient logic Consistency > Complexity 💯 Slowly building problem-solving mindset every day. #Day78 #CodingJourney #Java #DSA #LeetCode #Consistency #FutureDeveloper
To view or add a comment, sign in
-
-
Day 52 : Practicing Binary Trees on LeetCode 💡 Today’s live practical session in Alpha Plus 7.0 we solve some Binary Trees bases questions on LeetCode to test our logic. What I practiced today: ✅ Binary Tree Execution: Reinforced our core concepts by solving practical problems and tracing the exact flow of the nodes. ✅ Preorder Traversal: tackled the "Binary Tree Preorder Traversal" problem on LeetCode. ✅ Build the logic breakdown #BinaryTree #LeetCode #ProblemSolving #DSA #Java #SoftwareEngineering #100DaysOfCode #ApnaCollege
To view or add a comment, sign in
-
-
#Day82 Of Problem Solving Solved today’s LeetCode Daily Question and got all test cases accepted. Focused on finding the minimum distance between the target element and the given start index. Kept the approach simple—iterated through the array and updated the minimum distance using Math.abs(). Clean logic, efficient, and gets the job done. Performance: Runtime: 1 ms Memory: 45.04 MB Small problems like this are a good reminder that clarity in thinking often beats overcomplication. Staying consistent with daily practice. #LeetCode #Java #ProblemSolving #DSA #CodingJourney #LeetCode #LinkedIn
To view or add a comment, sign in
-
-
🚀 Day 56 — LeetCode Practice Today’s problem was all about careful pointer handling and avoiding boundary errors. ✅ Problem solved: Duplicate Zeros 💡 Key learnings from today: • Learned how to manage two pointers (read & write) effectively • Understood why boundary conditions are important to avoid runtime errors • Practiced handling cases where one input element produces multiple outputs • Improved debugging skills by fixing index-related mistakes ⚡ Approach used: • Used an extra array to store results • Ensured no out-of-bounds errors using proper checks • Maintained O(n) time complexity Every day I’m getting better at writing clean and error-free logic 💻✨ #Day56 #LeetCode #Java #CodingJourney #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 81 of #LeetCode Journey Solved: Subarray Sums Divisible by K Today’s problem helped me understand the power of Prefix Sum + HashMap optimization. 💡 Key Learning: Instead of checking all subarrays (O(n²)), we can use modulo + frequency map to reduce it to O(n). If two prefix sums have the same remainder, the subarray between them is divisible by K. 🧠 Concepts used: Prefix Sum Modulo Arithmetic HashMap (Frequency Count) ✅ Result: Accepted ✔️ Consistency is building confidence day by day 💪 #Day81 #DSA #Java #LeetCode #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 17 of My LeetCode Journey 📌 Solved: LeetCode #11 – Container With Most Water Today’s problem was a great example of applying the Two Pointer Approach efficiently. 🔍 Problem Summary: Given an array of heights, find two lines that together with the x-axis form a container that holds the maximum amount of water. 💡 Approach Used: Started with two pointers at both ends Calculated area using: min(height[left], height[right]) × width Moved the pointer with smaller height to maximize area ⚡ Key Learning: Instead of checking all pairs (O(n²)), we can optimize to O(n) using the two-pointer technique. 🧠 Time Complexity: O(n) 📦 Space Complexity: O(1) 🔥 Consistency is the key — learning something new every day! #LeetCode #DSA #Java #CodingJourney #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 54 — LeetCode Practice 🚀 ✅ Problem Solved: Sort Array By Parity 💡 What I learned today: • Understood how to separate even and odd numbers efficiently • Practiced using an extra array to store results in order • Learned a simple two-pass approach: first evens, then odds • Realized how clean logic can make problems easier without complex tricks 📊 Approach: First loop → store all even numbers Second loop → store all odd numbers ⏱ Time Complexity: O(n) 📦 Space Complexity: O(n) Small problem, but great for strengthening array manipulation skills! 💪 #Day54 #LeetCode #DSA #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 101 - LeetCode Journey Solved LeetCode 856: Score of Parentheses ✅ Looks tricky at first, but turns out to be a neat pattern problem. Instead of using a stack, used depth tracking + bit manipulation to calculate score efficiently. Core idea: Every "()" contributes 2^depth So just track depth and add score at the right moment. Key learnings: • Understanding pattern inside parentheses • Using depth instead of extra space • Bit manipulation for optimization ⚡ • Clean O(n) solution without stack ✅ All test cases passed ⚡ O(n) time | O(1) space Simple logic, powerful result 💡 #LeetCode #DSA #Stack #BitManipulation #Java #CodingJourney #ProblemSolving #InterviewPrep
To view or add a comment, sign in
-
-
Day 31/50 🚀 — Reverse Vowels of a String (LeetCode 345) Today’s problem was a great reminder that sometimes the simplest approaches are the most efficient. 🔹 Used the two-pointer technique 🔹 Focused on in-place swapping 🔹 Optimized for both time (O(n)) and space (O(1)) Key takeaway: Instead of overthinking, break the problem into smaller checks—identify vowels, move pointers smartly, and swap only when needed. Clean and efficient 💡 Happy to see this solution performing well: ⚡ Runtime: 2 ms (faster than 99%+) 📦 Space: Decent optimization #Day31 #LeetCode #DSA #Java #CodingJourney #50DaysOfCode #ProblemSolving #SoftwareEngineering
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