#include <iostream> using namespace std; bool isPalindrome(int x) { if (x<0) { return false;} int temp = x,goal = 0; while(temp%10!=0||temp!=0){ goal = goal*10 + temp%10; temp = temp/10; } if (x==goal){ return true;} else{ return false;} } int main(){ int a = 135696531; cout<<isPalindrome(a)<<endl; return 0; }
leetcode Palindrome
最新推荐文章于 2022-10-26 18:02:14 发布