Created
February 21, 2019 01:39
-
-
Save amraks/65be7ee949298301a063d8c80dff2802 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
class Solution(object): | |
def isPalindrome(self, s): | |
""" | |
:type s: str | |
:rtype: bool | |
""" | |
t = '' | |
s = s.lower() | |
for c in s: | |
if re.match(r'[a-zA-Z0-9]', c): | |
t = t + c | |
print(t) | |
return t == t[::-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment