cheetcode

10. Valid PalindromeEasy

Ignore punctuation and casing, then check if the string reads the same both ways.

Given a string s, return true if it is a palindrome, or false otherwise.

Only alphanumeric characters count, and uppercase and lowercase letters should be treated as the same character.

Examples

Input: s = "A man, a plan, a canal: Panama"
Output: true
Input: s = "race a car"
Output: false
Input: s = " "
Output: true

Constraints

  • 1 <= s.length <= 200,000
  • s consists of printable ASCII characters.