[leetcode-125] Palindrome + Slicing
ยท
๐ข One step
using Slicing leetcode-125 + ์ ๊ท์ ์ฌ์ฉimport re import collections class Solution: def isPalindrome(self, s: str) -> bool: s = s.lower() s = re.sub('[^a-z0-9]','',s) return s == s[::-1] # reverse Result : 46ms Memory: 15.7mb