easy
Valid Palindrome
For an ASCII string s, ignore non-alphanumeric characters and letter case. Return whether the remaining characters read the same in both directions. The empty normalized string is a palindrome.
Constraints
- 0 ≤ length ≤ 200000
- ASCII input only
Examples
in: ["Was it a car or a cat I saw?"]
out: true
Ignore ASCII punctuation and case
in: ["coding"]
out: false
Not a palindrome
Code it yourself
Solve in
Practice journal →Draft saved in this browser.
Public test cases · contract v1
Arguments are passed to your function. Tests are public practice checks, not hidden interview grading. Passing does not prove every possible input.
- Ignore ASCII punctuation and case
["Was it a car or a cat I saw?"] → true
- Not a palindrome
["coding"] → false
- Only punctuation
[".,!?"] → true
- Digits matter
["0P"] → false
- Empty
[""] → true
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.