Solution in python


  • 0
    K
    def revIn(num):
    	rev_num=0
    	num1 = num
    	if(num < 0):
    		num = num * -1
    	while int(num) > 0:
    		rev_num = (rev_num *10) + (num % 10)
    		num = int(num/10)
    	if num1 < 0:
    		rev_num = rev_num * -1
    	print (rev_num)
    

Log in to reply
 

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