01. 유효한 팰린드롬(leetcode: 125)
풀이
# re.sub(pattern, repl, string, count=0, flags=0)
s = re.sub([^A-Za-z0-9], "", s).lower()deq = collections.deque(s.lower())
while len(deq) > 1:
if deq.popleft() != deq.pop():
return False
return TrueLast updated