Valid Palindrome

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forwards and backwards. Alphanumeric characters include letters and numbers. Given a string, determine if it is a palindrome.

Constraints

  • 1 <= s.length <= 2 * 10^5
  • s consists only of printable ASCII characters.
Saving… · 2 lines
class Solution:
def isPalindrome(self, s: str) -> bool:
Console

Click Run to execute sample tests.