Accepted Python Code


  • 0
    L

    Accepted Python Code:

            if cmp(x,0) == -1:
                return False
            
            digit = 0
            n = x
            while n > 0:
                n=n/10
                digit += 1
            
            for i in range(1, digit/2+1):
                if (x%(10**i)-x%(10**(i-1)))/(10**(i-1)) != (x/(10**(digit-i)) - 10*(x/(10**(digit-i+1)))):
                    return False
            return True
    

Log in to reply
 

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