Leetcode 7 Reverse Integer
#include <sstream>
#include <string>
using namespace std;
class Solution {
public:
int reverse(int x) {
int y = 0;
while(x != 0){
if (y > INT_MAX / 10 || y < INT_MIN /10)
return 0;
int temp= x % 10;
y =10*y + temp;
x = x / 10;
}
return y;
}
};