import collections
import re
class Solution:
def isPalindrome(self, s: str) -> bool:
q_str: Deque = collections.deque()
[q_str.append(char.lower()) for char in s if char.isalnum()]
while len(q_str) > 1:
if q_str.popleft() != q_str.pop():
return False
return True
import collections
import re
class Solution:
def isPalindrome(self, s: str) -> bool:
s = re.sub('[^a-zA-Z0-9]','',s).lower()
return s == "".join(reversed(s))
return s == "".join(reversed(s))