Day 38 | LeetCode Learning Journal 🚀 Today I solved Valid Palindrome using the two-pointer approach. This problem helped me understand how to efficiently process strings while ignoring unnecessary characters! 🔑 Key Points: • Given a string, check if it is a palindrome. • Ignored non-alphanumeric characters (spaces, symbols). • Compared characters in a case-insensitive manner. • Used two pointers (left & right) for efficient checking. 🌱 What I Learned: • How to use the two-pointer technique for string problems. • Importance of handling edge cases (special characters). • Optimizing space complexity (no extra string needed). • Writing clean and efficient logic for real-world scenarios. #LeetCode #100DaysOfCode #DSA #CodingJourney #Day38 🚀
Valid Palindrome Solution with Two-Pointer Approach
More Relevant Posts
-
🚀 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
-
-
100 LeetCode problems solved ! and honestly, it's taught me more about thinking than coding. When I started, I used to jump straight to the solution. Now I've learned to slow down — understand the problem, think brute force first, then optimize. Patterns I've been focusing on: → Sliding Window → Two Pointers → Stack & Queue → Kadane's Algorithm → Prefix Sum → Merge Intervals → Linked List The biggest shift wasn't in the number of problems solved — it was learning to recognize WHY a particular approach works, not just HOW. Still a long way to go. But consistency is starting to show results. 100 done. More to come. 🎯 #DSA #LeetCode #CodingJourney #SoftwareEngineering #100Problems
To view or add a comment, sign in
-
-
Day 40 | LeetCode Learning Journal 🚀 Today I solved Validate Binary Search Tree (BST) using a range-based recursive approach. This problem helped me deeply understand how BST properties apply to the entire tree, not just immediate children! 🔑 Key Points: • Checked whether a binary tree is a valid BST. • Maintained a valid range (min, max) for each node. • Ensured every node follows BST rules globally. • Used recursion to traverse and validate nodes. 🌱 What I Learned: • Importance of passing constraints (min/max) in recursion. • Difference between local vs global validation in trees. • Strengthened understanding of Binary Search Tree properties. • Improved recursive thinking for tree problems. #LeetCode #100DaysOfCode #DSA #CodingJourney #Day40 🚀
To view or add a comment, sign in
-
-
🚀 Day 40 | 100 Days of Coding Challenge #DrGViswanathanChallenge 📘 Problem Solved: Sum of Subarray Ranges (LeetCode) 🔧 Approach Used (Brute Force): • Considered every possible subarray • Maintained current minimum and maximum while expanding subarray • Calculated range = max - min for each subarray • Added all ranges to get final answer 📌 Key Idea: For each subarray, track the largest and smallest element, and compute their difference. ⏳ Complexity: Time: O(n²) Space: O(1) 🧠 Key Learning: Even though brute force works, it helps in understanding the pattern before optimizing. 💡 Optimization Insight: This problem can be optimized using monotonic stacks by calculating contribution of each element as min and max separately. 📂 Topics Covered: Arrays, Brute Force 📊 Example: Input: [1,2,3] Output: 4 🔥 Step by step moving from brute force → optimal solutions 🚀 #100DaysOfCode #DSA #CPP #LeetCode #CodingJourney #CompetitiveProgramming
To view or add a comment, sign in
-
-
🚀 Day 33 | 100 Days of Coding Challenge #DrGViswanathanChallenge 📘 Problem Solved: Valid Parentheses (LeetCode) 🔧 Approach Used (Stack): • Traversed the string character by character • Pushed all opening brackets onto the stack • For every closing bracket, checked the top of the stack • Ensured correct matching and order 📌 Key Idea: Last opened bracket should be the first to close → perfect use of LIFO (Stack) ⏳ Complexity: Time: O(n) Space: O(n) 🧠 Key Learning: Stacks are ideal for problems involving balanced expressions and order validation. 📂 Topics Covered: Stack, Strings, Expression Validation #100DaysOfCode #DSA #CPP #LeetCode #CodingJourney #CompetitiveProgramming
To view or add a comment, sign in
-
-
LeetCode Progress 42/50 — Find the Difference Today I worked on a fundamental problem focused on string manipulation and character analysis 🧩 💡 The challenge was to find the extra character in one string compared to another. 🧠 Approach: Used XOR / frequency mapping to efficiently cancel matching characters and directly identify the added character. ⏱ Time Complexity: O(n) 💡 What I learned: This problem strengthened my understanding of how bit manipulation and hashing techniques can simplify string comparison problems. 📈 Improving efficiency in problem-solving and strengthening core DSA fundamentals. #LeetCode #DSA #Strings #ProblemSolving #Cpp #CodingJourney #Consistency 🚀
To view or add a comment, sign in
-
-
LeetCode Progress 19/50 — Third Maximum Number I worked on a problem focused on array traversal and finding distinct elements 🧩 💡 The challenge was to find the third distinct maximum number in an array, and if it does not exist, return the maximum number. 🧠 Approach: Tracked the top three distinct maximum values while iterating through the array, ensuring duplicates were ignored. This avoided the need for extra sorting and kept the solution efficient. ⏱ Time Complexity: O(n) 💡 What I learned: This problem reinforced how maintaining a few variables smartly can replace the need for sorting and lead to optimized solutions. 📈 Improving efficiency in handling arrays and focusing on writing optimized logic. #LeetCode #DSA #ProblemSolving #Cpp #CodingJourney #Consistency 🚀
To view or add a comment, sign in
-
-
🚀 Staying consistent and progressing step by step in my LeetCode journey. LeetCode Progress 11/50 — Can Make Arithmetic Progression From Sequence I worked on a problem focused on pattern recognition and sequence validation 🧩 💡 The challenge was to determine whether a given array can be rearranged to form an arithmetic progression. 🧠 Approach: Sorted the array and calculated the common difference between consecutive elements. Then verified if all adjacent pairs maintained the same difference throughout the array. ⏱ Time Complexity: O(n log n) 💡 What I learned: This problem highlighted how sorting can simplify pattern-based problems and make validation much more straightforward. 📈 Improving understanding of sequences and strengthening problem-solving skills with each step. #LeetCode #DSA #ProblemSolving #Cpp #CodingJourney #Consistency 🚀
To view or add a comment, sign in
-
-
LeetCode Progress 32/50 — Generate Parentheses Today I worked on a problem focused on recursion and backtracking 🧩 💡 The challenge was to generate all possible combinations of well-formed parentheses for a given number of pairs. 🧠 Approach: Used a backtracking approach by recursively adding opening and closing parentheses while maintaining valid combinations at each step. This ensured only well-formed patterns were generated. ⏱ Time Complexity: O(4ⁿ / √n) 💡 What I learned: This problem highlighted how backtracking can be used to systematically explore valid combinations while pruning invalid paths early. 📈 Strengthening understanding of recursion and improving confidence in solving pattern-generation problems. #LeetCode #DSA #Backtracking #ProblemSolving #Cpp #CodingJourney #Consistency 🚀
To view or add a comment, sign in
-
-
Day 11: LeetCode 344 – Reverse String Sometimes the simplest problems are the ones that sharpen your fundamentals the most. Today’s problem focused on reversing a character array in-place, and the cleanest way to approach it was using the two-pointer technique. 🔹 Key Idea: Instead of creating a new array, use two pointers: One at the beginning One at the end Swap them and move inward until they meet. This approach avoids extra space and keeps the solution efficient. 🔹 What I learned: Not every problem needs complex logic In-place operations are important for optimization Two pointers are extremely powerful for array/string problems 🔹 Complexity: Time → O(n) Space → O(1) Small problem, but a strong reminder: mastering basics is what builds consistency in DSA. Day 11 Completed. #Day11 #LeetCode #DSA #Cpp #CodingJourney #TwoPointers
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