Перейти к содержимому

String-5 | 125. Valid Palindrome | 🔥 Beginner, Medium & Advanced Level! #easy

CTO Bhaiya

0:00 / 0:00

String-5 | 125. Valid Palindrome | 🔥 Beginner, Medium & Advanced Level! #easy

2 560 просмотров · 1 г. назад
CTO Bhaiya
113 тыс. подписчиков
2 560 просмотров · 1 г. назад
SHEET LINK: https://app.nextgen-cto.in/login JOIN MY WHATSAPP COMMUNITY FOR UPDATES: https://chat.whatsapp.com/BTlYJt2pCxj... Support me 🙌🏻: https://www.buymeacoffee.com/anuj.bar... Leetcode: https://leetcode.com/problems/valid-p... Github Repo: https://github.com/team-codebug/leetcode Notes: https://github.com/team-codebug/leetc... 3 Months DSA for Placements! 🚀 Beginner to Advanced Playlist *YouTube Video Description:* 🔍 *Leetcode 125: Valid Palindrome - Two Pointer Approach Explained!* 🔍 🚀 In this video, we solve the *Valid Palindrome* problem from Leetcode (#125) using an *optimized two-pointer approach* that runs in **O(n) time and O(1) space**. ✅ *Two-Pointer Approach (Constant Space):* 1️⃣ *Initialize two pointers* – One at the *start* (`left`) and one at the *end* (`right`). 2️⃣ *Skip non-alphanumeric characters* – Move pointers inward if they encounter spaces, punctuation, or special characters. 3️⃣ *Compare characters* – If `s[left]` and `s[right]` are not the same (ignoring case), return `false`. 4️⃣ **Continue until pointers meet**, ensuring an in-place solution without extra space. 📌 *What You’ll Learn:* ✔️ Problem statement & examples ✔️ Step-by-step coding walkthrough ✔️ Time & space complexity analysis ✔️ Handling edge cases like empty strings & mixed characters 📢 *Subscribe* for more coding solutions & DSA tips! 🔥 *Stay Connected:* 💬 Got questions? Drop a comment below, and let’s discuss! 🚀 🔖 *Hashtags:* #Leetcode #ValidPalindrome #CodingInterview #DataStructures #Algorithms #Leetcode125 #Python #Java #CPlusPlus #DSA #SoftwareEngineering #CodingChallenge #InterviewPreparation #Programming #TwoPointerApproach #EfficientCoding #PalindromeCheck =========================== ➡️ Connect with me: LinkedIn :   / anuj-kumar-9a188968   Instagram :   / mr.anuj.brandy   Discord :   / discord   ===========================