题目描写叙述:
Determine whether an integer is a palindrome. Do this without extra space.
代码:
bool Solution::isPalindrome(int x){ int a = x; int b = 0; while(a > 0) { b = b * 10 + a % 10; a = a % 10; } return b == x;}
本文共 242 字,大约阅读时间需要 1 分钟。
题目描写叙述:
Determine whether an integer is a palindrome. Do this without extra space.
代码:
bool Solution::isPalindrome(int x){ int a = x; int b = 0; while(a > 0) { b = b * 10 + a % 10; a = a % 10; } return b == x;}
转载地址:http://ptlhl.baihongyu.com/