It is very easy question, but what is maximum of limit?


  • 0
    W
    class Solution(object):
        def reverse(self, x):
            """
            :type x: int
            :rtype: int
            """
            if x<0:
                return -1*self.reverse(-1*x)
            elif x>2**31-1:
                return 0
            y=0
            while x>=1:
                y=10*y+x%10
                x/=10
            return y

Log in to reply
 

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