面试算法一

bool checknumber(unsigned int number)
{

unsigned int array[32] = {0};
//查找首位置对称数字
unsigned int first= 0;
unsigned int num = number;

while(num)
{
array[first] = num%10;
num = num/10;
first++;
}
for(unsigned int i = 1; i <= first; i++)
{
if(array[i - 1] != array[first - i])
{
return false;
}
}
return true;
}

你可能感兴趣的:(算法,面试)