标签:code while return pre ali nbsp rom color ==
//反转之后判断就行了
class Solution { public: bool isPalindrome(int x) { int t = x; if(x < 0) return false; int sum = 0; while(x > 0){ sum = sum*10 + x%10; x = x/10; } if(sum == t) return true; return false; } };
标签:code while return pre ali nbsp rom color ==
原文地址:https://www.cnblogs.com/cunyusup/p/9613263.html