Valid Palindrome Problem Solution with Two Pointers

🚀 Day 58 of #100DaysOfCode Today’s problem focused on combining string processing + two pointers — 🔍 LeetCode 125: Valid Palindrome A great example of how small edge cases can make a simple problem interesting. 📌 Problem Summary Given a string s, determine whether it is a palindrome by: Ignoring non-alphanumeric characters Treating uppercase and lowercase letters as the same 🧠 Approach Used: Two Pointers ✔️ Initialize two pointers: left at the start right at the end ✔️ Skip non-alphanumeric characters ✔️ Compare characters in a case-insensitive manner ✔️ Move inward until pointers meet If all comparisons match → it’s a palindrome ✅ ⚙️ Complexity Analysis ⏱ Time Complexity: O(n) 💾 Space Complexity: O(1) ✔️ 488 / 488 test cases passed 🚀 Runtime: 2 ms (Beats ~99%) 🔥 Key Learning This problem reinforces: Two-pointer technique on strings Careful handling of edge cases Writing clean helper functions for readability Simple logic + correct filtering = solid solution 💪 Onward to Day 59 🚀 #100DaysOfCode #LeetCode #ValidPalindrome #TwoPointers #Java #DSA #ProblemSolving #CodingJourney #Consistency

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories