Skip to content

Instantly share code, notes, and snippets.

@amraks
Created February 21, 2019 01:39
Show Gist options
  • Save amraks/65be7ee949298301a063d8c80dff2802 to your computer and use it in GitHub Desktop.
Save amraks/65be7ee949298301a063d8c80dff2802 to your computer and use it in GitHub Desktop.
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