Given an integer n, reverse its digits and return the result.
n is negative, the reversed number should also be negative.120 becomes 21).For example, 123 becomes 321, and -456 becomes -654.
n = 123321n = -456-654n = 12021-10^9 <= n <= 10^9The result is guaranteed to fit within a 32-bit signed integer.Run your code to see results
Use Cmd+Enter to run