Determine whether an integer is a palindrome. Do this without extra space.
1 class Solution { 2 public: 3 bool isPalindrome(int x) { 4 int x1 = 0; 5 if(x<0) 6 return false; 7 int x2=x; 8 while (x) 9 { 10 x1 = x1 * 10; 11 x1+=x % 10; 12 x = x / 10; 13 } 14 if (x1 == x2) 15 return true; 16 else 17 return false; 18 } 19 };