判断是否是回文数(java):
class Solution
{
public bollean isPalindrome(int x)
{
int index=0;
int term = x;
if(term<0)
{
return false;
}
else
{
while(term!=0)
{
index = index*10+term%10;
term/=10;
}
if(index == x)
{
return true;
}
else
{
return false;
}
}
}
}
2021-08-04
于 2021-08-04 17:25:36 首次发布