Solution in python


  • 0
    K

    '''
    class Solution:
    def reverse(self, x):
    """
    :type x: int
    :rtype: int
    """
    isNegative = False
    if(x<0):
    isNegative = True
    x = abs(x)
    s = ''.join(reversed(str(x)))
    s = int(s)
    if(isNegative):
    s = -s
    if(abs(s) > 2**31):
    s = 0
    return s
    '''


Log in to reply
 

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