Valid Palindrome
Easy
Two Pointers
String
Regular Expression
A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Given a string s, return true if it is a palindrome, or false otherwise.
Examples:
Input:
"A man, a plan, a canal: Panama"Output:
trueExplanation: "amanaplanacanalpanama" is a palindrome.
Input:
"race a car"Output:
falseExplanation: "raceacar" is not a palindrome.
Constraints:
- 1 ≤ s.length ≤ 2 * 10⁵
- s consists only of printable ASCII characters.
Code Editor
Loading advanced editor...
Console Output
Ready to execute
Click "Run Code" to see your output here