Solved LeetCode 125 Valid Palindrome in Python

Day 53/100 – #100DaysOfCode 🚀 Solved LeetCode #125 – Valid Palindrome (Python). Today I practiced string cleaning and validation to check whether a given string is a palindrome. Approach: 1) Traverse the string and keep only alphanumeric characters. 2) Convert all characters to lowercase. 3) Build a cleaned string. 4) Compare the string with its reverse. 5) If both are equal, return True; otherwise, return False. Time Complexity: O(n) Space Complexity: O(n) Learning how preprocessing simplifies string problems 💪 #LeetCode #Python #DSA #Strings #ProblemSolving #100DaysOfCode

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories