【题目描述】
Check a positive number is a palindrome or not.
A palindrome number is that if you reverse the whole number you will get exactly the same number.
Notice
It's guaranteed the input number is a 32-bit integer, but after reversion, the number may exceed the 32-bit integer.
判断一个正整数是不是回文数。
回文数的定义是,将这个数反转之后,得到的数仍然是同一个数。
注意事项
给的数一定保证是32位正整数,但是反转之后的数就未必了。
【题目链接】
www.lintcode.com/en/problem/palindrome-number/
【题目解析】
这道题很明显是一道数学题,计算一个数字是否是回文数字,我们其实就是将这个数字除以10,保留他的余数,下次将余数乘以10,加上这个数字再除以10的余数.
需要注意的点:
1、负数不是回文数字.
2、0是回文数字.
【参考答案】