Skip to main content

Valid Palindrome

EasyArrays & Strings

Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring case.

Example:

Input: s = "A man, a plan, a canal: Panama"
Output: true
Explanation: "amanaplanacanalpanama" is a palindrome

Input: s = "race a car"
Output: false

Constraints:

  • 1 <= s.length <= 2 * 10^5
  • s consists of printable ASCII characters