Reverse Integer Solution in python


  • 0
    M
    def reverse(num):
        r = 0
        while num > 0:
            r *= 10
    
            r += num% 10
    
            num /= 10
    
    
        return r
    print(reverse(100))
    

Log in to reply
 

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