标签:ber rmi des for nbsp when return sam esc
Description:
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Solution:
1 bool isPalindrome(int x) { 2 if (x < 0) { 3 return false; 4 } 5 int revert = 0; 6 int tmp = x; 7 while (tmp) { 8 revert = revert * 10 + xx % 10; 9 tmp /= 10; 10 } 11 if (revert == x) { 12 return true; 13 } 14 return false; 15 }
just like reverse integer...
标签:ber rmi des for nbsp when return sam esc
原文地址:https://www.cnblogs.com/ouch/p/9727267.html