Valid Palindrome
Updated Feb 24, 2026
Problem
Given a string s, return true if it is a palindrome, or false otherwise.
A palindrome reads the same forward and backward after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters.
Constraints
1 <= s.length <= 2 * 10^5
s consists of printable ASCII characters.
Examples
Example 1
Input:
s = "A man, a plan, a canal: Panama"
Output:
true
Example 2
Input:
s = "race a car"
Output:
false
Function Signature
def isPalindrome(self, s: str) -> bool
How to Submit
Implement a Solution class with a isPalindrome method.
Your method will be called with the input parameters and should return the answer.