Valid Palindrome
Given a string s, return true if it reads the same forwards and backwards after lowercasing and removing every non-alphanumeric character, and false otherwise.
An empty string (after cleaning) counts as a palindrome.
Example cases
- classicin s = "A man, a plan, a canal: Panama"out trueCleaned to "amanaplanacanalpanama", a palindrome.
- not a palindromein s = "race a car"out false
- empty after cleaningin s = " "out true
- alphanumeric mixin s = "0P"out false
Constraints
- 1 <= s.length <= 2 * 10^5
- s consists only of printable ASCII characters.
s =
"A man, a plan, a canal: Panama"