def lc_reverse_integer(n):
    """
    Given a 32-bit signed integer, reverse digits of an integer. Assume we are dealing with an environment which could
    only hold integers within the 32-bit signed integer range. For the purpose of this problem, assume that your
    function returns 0 when the reversed integer overflows.
    Examples:

    >>> lc_reverse_integer(123)
    321
    >>> lc_reverse_integer(-123)
    -321
    >>> lc_reverse_integer(120)
    21
    """
    class Solution(object):

        @staticmethod
        def reverse(x):

            neg = x < 0
            if neg:
                x = -x

            result = 0
            while x:
                result = result * 10 + x % 10
                x /= 10

            if result > 2 ** 31:
                return 0

            return -result if neg else result

    return Solution.reverse(n)