Python Submission 64 ms


  • 0
    V
    class Solution(object):
        def reverse(self, x):
            """
            :type x: int
            :rtype: int
            """
            r = 0
            if x<0:
                x=-x
                r=-int(str(x)[::-1])
            else:
                r=int(str(x)[::-1])
            if r < -2147483647 or r > 2147483647:
                print r
            else:
                return r

Log in to reply
 

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