One Line Python!


  • 0
    W
    class Solution(object):
        def isPalindrome(self, s):
            """
            :type s: str
            :rtype: bool
            """
            return ''.join([s[i] for i in range(len(s)) if s[i].isalnum()]).lower() == ''.join(
                [s[i] for i in range(len(s)) if s[i].isalnum()]).lower()[::-1]
    

Log in to reply
 

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