python solution using regular expression


  • 0
    C
    def isPalindrome(self, s):
        import re
        ree=re.compile('\w')
        s=s.upper()
        res_pos=ree.findall(s)
        res_nag=res_pos[::-1]
        return res_nag==res_pos
        """
        :type s: str
        :rtype: bool
        """

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.