public boolean isPalindrome(int x) {
int i=1;
if(x<0) return false;
while(i<=x/10)
{
i*=10;
}
for(int j=1;j<i;j*=10,i/=10)
{
int dh=(x/i)%10;
int dl=(x/j)%10;
if(dh!=dl) return false;
}
return true;
}
JAVA solution according to the hint...

I didn't mean that. If the palindrome number is very long, the INT or even LONG LONG type cannot store it. Then, you must use a string or other structure to store the number. In this case, the space complexity will be O(length(n)).
The point is if you can flip the half of the linked list, then not matter how long the list is we still can use the same constant space to solve it.
Furthermore, the fact that the number given by the problem is stored in a list actually implicit that the length may be too long to store in a INT or whatever variable.