10: Reverse integer

Write a method to reverse digits of an integer

 

Example 1

Input: 12

Output: 21

Example 2

Input: -12

Output: -21

Note: return -1 when the reversed integer overflows