125. Valid Palindrome
https://leetcode.com/problems/valid-palindrome/
solution
class Solution:
def isPalindrome(self, s: str) -> bool:
s = s.lower()
s = [i for i in s if i.isalnum()] # isdigit, isalpha, isalnum(alphanumeric)
return s[::-1] == s
时间复杂度:O() 空间复杂度:O()
follow up
怎么处理特殊符号/regex
Last updated