Valid Palindrome
Problem statement
Return whether s reads the same forward and backward after ignoring all characters except ASCII letters and digits and treating uppercase and lowercase letters as equal.
The empty string and a string with no letters or digits are palindromes.
Function
isPalindrome(s: String) → booleanExamples
Example 1
s = "Was it a car or a cat I saw?"return = trueIgnoring spaces, punctuation and letter case gives wasitacaroracatisaw, which reads the same in both directions. Return true.
Example 2
s = "0P"return = falseThe normalized characters are 0 and p. They differ, so return false.
Constraints
0 <= s.length <= 500- Every character is printable ASCII, with a code from 32 through 126.