Impliment the reverse function, which takes in input n and reverses it. For instance, `reverse(123)` should return `321`. You should do this without converting the inputted number into a string.

Difficulty: introductory

Starter code:

def reverse(n):
	

Solutions:
def reverse(n):
    m = 0
    while n > 0:
        n, m = n // 10, m * 10 + n % 10
    return m

def reverse(n):
    return int(str(n)[::-1])

def reverse(n):
    r = 0
    while n:
        r = r*10 + n%10
        n //= 10
    return r

def reverse(n):
    """Returns n with all digits reversed. Assume positive n."""
    rev = lambda n, r: rev(n // 10, 10 * r + n % 10) if n > 0 else r
    return rev(n, 0)

def reverse(n):
    rev = 0
    while n:
        rev = rev * 10 + n % 10
        n //= 10
    return rev

def reverse(n, r=0):
    return reverse(n // 10, r * 10 + n % 10) if n else r

def reverse(n):
    return int('{:d}'.format(n)[::-1])

import math
def reverse(hernia):
    power = int(math.log10(hernia))
    if power == 0:
        return hernia
    else:
        return ((hernia % 10) * (10 ** power)) + reverse(hernia // 10)

def reverse(n, acc = 0):
    return acc if n == 0 else reverse(n//10, acc*10 + n%10)

from math import log10

def reverse(n):
    l = int(log10(n))
    return sum(((n // 10**i) % 10) * 10**(l - i) for i in range(l + 1))