Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Example2: x = -123, return -321
class Solution { public: int reverse(int x) { long res = 0; while(x) { res *= 10; int y = x % 10; res += y; x /= 10; } if(abs(res) & (0x1111<<31)) return 0; return res; } };