题目链接
https://leetcode.com/problems/palindrome-number/
题目原文
Determine whether an integer is a palindrome. Do this without extra space.
题目翻译
判断一个整数(integer)是否是回文,不要使用额外的空间。
思路方法
该题目还有一些官方的提示:
Some hints:
Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string, note the restriction of using extra space.
You could also try reversing an integer. However, if you have solved the problem “Reverse Integer”, you know that the reversed integer might overflow. How would you handle such case?
There is a more generic way of solving this problem.
大概就是告诉我们:1,负数都不是回文数;2,不能通过将数字转为字符串来判断回文,因为使用了额外的空间ÿ