MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / isPalindrome

Method isPalindrome

String/ValidPalindrome.py:26–38  ·  view source on GitHub ↗

:type s: str :rtype: bool

(self, s)

Source from the content-addressed store, hash-verified

24
25class Solution(object):
26 def isPalindrome(self, s):
27 """
28 :type s: str
29 :rtype: bool
30 """
31
32 if not s:
33 return True
34
35 s = s.lower()
36 x = ''.join(re.findall(r'[a-z0-9]{1}', s))
37
38 return x == x[::-1]
39

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected