Skip to content
Onsite

Check for Palindrome

EasyP1Coding

Return true if s is a palindrome after you convert upper-case letters to lower case and ignore every character that is not a letter or digit. Otherwise return false. An empty result (no letters or digits) counts as a palindrome.

Example 1

Input
s = "A man, a plan, a canal: Panama"
Output
true
Why
It reads "amanaplanacanalpanama" both ways.

Example 2

Input
s = "race a car"
Output
false

Example 3

Input
s = " "
Output
true
Why
Nothing left after filtering.

Constraints

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

Hints

Run checks the 3 visible tests, Submit all 8.