判断一个整数是否是回文。
是回文,返回true,不是回文,返回false.
示例1
Input: x = 121
Output: true
Explanation: 121 reads as 121 from left to right and from right to left.
Input: x = -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
Input: x = 10
Output: false
Explanation: Reads 01 from right to left. Therefore it is not a palindrome.
先将数组转换为字符串,
判断第字符串的一个字符和最后一个字符是否想同,不同则不是回文,相同的话,判断第二个字符与字符串的倒数第二个数是否相同,依此类推,一直到字符串长度的一半,都相同的话,则是回文。