Given N,  reverse the digits of N.
 
Example 1:
Input: 200
Output: 2
Explanation: By reversing the digts of 
number, number will change into 2.
Example 2:
Input : 122
Output: 221
Explanation: By reversing the digits of 
number, number will change into 221.
 
Your Task:
You don't need to read or print anything. Your task is to complete the function reverse_digit() which takes N as input parameter and returns the reversed number.
 
Expected Time Complexity: O(Log(N))
Expected Space Complexity: O(1)
 
Constraints:
1 <= N <= 10^{15}

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3

class Solution:
	def reverse_digit(self, n):
		# Code here

Solutions:
class Solution:

	def reverse_digit(self, n):
		string = str(n)
		s1 = ''
		for i in string[::-1]:
			s1 += i
		return int(s1)


class Solution:

	def reverse_digit(self, n):
		x = str(n)[::-1]
		return int(x)


class Solution:

	def reverse_digit(self, n):
		temp = n
		new = 0
		while temp != 0:
			digit = temp % 10
			new = new * 10 + digit
			temp = temp // 10
		return new


class Solution:

	def reverse_digit(self, n):
		temp = n
		reverse = 0
		while temp > 0:
			reverse = reverse * 10 + temp % 10
			temp //= 10
		return reverse


class Solution:

	def reverse_digit(self, n):
		wno = n
		rev = 0
		while wno > 0:
			dig = wno % 10
			wno = wno // 10
			rev = rev * 10 + dig
		return rev


class Solution:

	def reverse_digit(self, n):
		return int(''.join(list(reversed(str(n)))))


class Solution:

	def reverse_digit(self, n):
		sum = 0
		while n > 0:
			sum = sum * 10 + n % 10
			n //= 10
		return sum


class Solution:

	def reverse_digit(self, n):
		string_num = str(n)
		stack = []
		for i in range(len(string_num) - 1, -1, -1):
			stack.append(string_num[i])
		original = int(''.join(stack))
		return original


class Solution:

	def reverse_digit(self, n):
		t = n
		value = 0
		while t > 0:
			d = t % 10
			value = value * 10 + d
			t = t // 10
		return value


class Solution:

	def reverse_digit(self, n):
		n = str(n)
		rev = n[::-1]
		num = int(rev)
		return num


class Solution:

	def reverse_digit(self, n):
		rev = 0
		while n > 0:
			a = n % 10
			rev = rev * 10 + a
			n = n // 10
		return rev


class Solution:

	def reverse_digit(self, n):
		z = str(n)
		y = z[::-1]
		return abs(int(y))


class Solution:

	def reverse_digit(self, n):
		m = str(n)
		return int(m[::-1])


class Solution:

	def reverse_digit(self, n):
		reversed_str = str(n)[::-1]
		reversed_num = int(reversed_str)
		return reversed_num


class Solution:

	def reverse_digit(self, n):
		list = []
		j = len(str(n)) - 1
		for i in range(len(str(n))):
			list.append(str(n)[j])
			j -= 1
		return int(''.join(list))


class Solution:

	def reverse_digit(self, n):
		n = str(n)
		n1 = n[::-1]
		n1 = int(n1)
		return n1


class Solution:

	def reverse_digit(self, n):
		b = str(n)[::-1]
		return int(b)


class Solution:

	def reverse_digit(self, n):
		reverse = 0
		while n > 0:
			remainder = n % 10
			reverse = reverse * 10 + remainder
			n = int(n / 10)
		return reverse


class Solution:

	def reverse_digit(self, n):
		N = str(n)
		N = N[::-1]
		N = int(N)
		return N


class Solution:

	def reverse_digit(self, n):
		k = ''
		while n > 0:
			rem = n % 10
			k += str(rem)
			n = n // 10
		return int(k)


class Solution:

	def reverse_digit(self, n):
		k = 0
		ans = 0
		while n > 0:
			t = n % 10
			n = int(n / 10)
			ans = ans * 10 + t
		return ans


class Solution:

	def reverse_digit(self, n):
		rev = 0
		while n > 0:
			div = n % 10
			rev = rev * 10 + div
			n = n // 10
		return rev


class Solution:

	def reverse_digit(self, n):
		t = str(n)[::-1]
		return int(t)


class Solution:

	def reverse_digit(self, n):
		rev = 0
		while n > 0:
			rem = n % 10
			rev = rev * 10 + rem
			n = n // 10
		return rev


class Solution:

	def reverse_digit(self, n):
		s = str(n)[::-1]
		return int(s)


class Solution:

	def reverse_digit(self, n):
		temp = n
		rev = 0
		while temp != 0:
			r = temp % 10
			rev = rev * 10 + r
			temp = temp // 10
		return rev


class Solution:

	def reverse_digit(self, n):
		k = str(n)
		r = int(k[::-1])
		return r


class Solution:

	def reverse_digit(self, n):
		n_str_list = list(str(n))
		i = 0
		j = len(n_str_list) - 1
		while i < j:
			(n_str_list[i], n_str_list[j]) = (n_str_list[j], n_str_list[i])
			i += 1
			j -= 1
		n_str = ''.join(n_str_list)
		return int(n_str)


class Solution:

	def reverse_digit(self, n):
		string = str(n)[::-1]
		return int(string)


class Solution:

	def reverse_digit(self, n):
		rev = 0
		while n != 0:
			digit = n % 10
			rev = rev * 10 + digit
			n = n // 10
		return rev


class Solution:

	def reverse_digit(self, n):
		num = 0
		while n:
			l = n % 10
			num = num * 10 + l
			n = n // 10
		return num


class Solution:

	def reverse_digit(self, n):
		num = 0
		while n:
			r = n % 10
			num = num * 10 + r
			n = n // 10
		return num


class Solution:

	def reverse_digit(self, n):
		num = str(n)[::-1]
		return num.lstrip('0')


class Solution:

	def reverse_digit(self, n):
		n = str(n)
		result = n[::-1]
		return int(result)


class Solution:

	def reverse_digit(self, n):
		ans = 0
		while n > 0:
			ans = ans * 10 + n % 10
			n = n // 10
		return ans


class Solution:

	def reverse_digit(self, n):
		reversed_int = ''
		while n > 0:
			reversed_int = reversed_int + str(n % 10)
			n = n // 10
		return int(reversed_int)


class Solution:

	def reverse_digit(self, n):
		r = 0
		t = n
		while t >= 1:
			r = r * 10 + t % 10
			t = t // 10
		return r


class Solution:

	def reverse_digit(self, n):
		r = 0
		while n > 0:
			re = n % 10
			r = r * 10 + re
			n = n // 10
		return r


class Solution:

	def reverse_digit(self, n):
		convertedstr = str(n)
		reversedconvertedstr = convertedstr[::-1]
		return int(reversedconvertedstr)


class Solution:

	def reverse_digit(self, n):
		temp = 0
		while n > 0:
			a = n % 10
			temp = temp * 10 + a
			n = n // 10
		return temp


class Solution:

	def reverse_digit(self, n):
		N = str(n)
		rev = 0
		for i in range(0, len(N)):
			val = n % 10
			rev = rev * 10 + val
			n = n // 10
		return rev


class Solution:

	def reverse_digit(self, n):
		var = str(n)
		result = var[::-1]
		answer = int(result)
		return answer


class Solution:

	def reverse_digit(self, n):
		a = str(n)
		return int(a[::-1])


class Solution:

	def reverse_digit(self, n):
		value = n
		digit = 0
		while n != 0:
			rem = n % 10
			digit = digit * 10 + rem
			n = n // 10
		return digit


class Solution:

	def reverse_digit(self, n):
		s = 0
		while n > 0:
			r = n % 10
			s = s * 10 + r
			n = int(n / 10)
		return s


class Solution:

	def reverse_digit(self, n):
		po = str(n)[::-1]
		return int(po)


class Solution:

	def reverse_digit(self, n):
		n = str(n)
		c = n[::-1]
		d = int(c)
		return d


class Solution:

	def reverse_digit(self, n):
		x = ''
		for i in str(n)[::-1]:
			x += i
		return int(x)


class Solution:

	def reverse_digit(self, n):
		temp = 0
		while n > 0:
			last = n % 10
			temp = temp * 10 + last
			n = n // 10
		return temp


class Solution:

	def reverse_digit(self, n):
		int1 = str(n)
		return int(int1[::-1])


class Solution:

	def reverse_digit(self, n):
		n = str(n)
		l = len(n) - 1
		string = ''
		while l >= 0:
			string += n[l]
			l -= 1
		return int(string)


class Solution:

	def reverse_digit(self, n):
		numb = str(n)
		rev = numb[::-1]
		rev = list(rev)
		i = 0
		while 1:
			if rev[i] == '0':
				del rev[i]
			else:
				break
		ans = ''.join(rev)
		return ans


class Solution:

	def reverse_digit(self, n):
		rev = 0
		while n != 0:
			d = n % 10
			rev = rev * 10 + d
			n = n // 10
		return rev


class Solution:

	def reverse_digit(self, n):
		reversed_n = 0
		sign = 1 if n >= 0 else -1
		n = abs(n)
		while n != 0:
			digit = n % 10
			reversed_n = reversed_n * 10 + digit
			n //= 10
		return reversed_n * sign


class Solution:

	def reverse_digit(self, n):
		given_number = n
		reverse_number = 0
		length_of_number = len(str(n))
		temp_len = length_of_number
		for count in range(length_of_number):
			reverse_number += given_number % 10 * 10 ** (temp_len - 1)
			given_number = given_number // 10
			temp_len = len(str(given_number))
		return reverse_number


class Solution:

	def reverse_digit(self, n):
		v = str(n)
		p = v[::-1]
		ans = int(p)
		return ans