Determine whether an integer is a palindrome. Do this without extra space.
long int reverse(int x) { long int ret = 0; while(x>0){ ret = ret*10 + x%10; x /= 10; } return ret; } bool isPalindrome(int x) { if(x<0) return false; //consider case of negative number if(x==reverse(x)) return true; else return false; }