Untitled
unknown
plain_text
a year ago
203 B
0
Indexable
class Solution { public: bool isPalindrome(int x) { long n=x; long sum=0; while(x>0){ sum=sum*10+x%10; x/=10; } return sum==n; } };
Editor is loading...
Leave a Comment
class Solution { public: bool isPalindrome(int x) { long n=x; long sum=0; while(x>0){ sum=sum*10+x%10; x/=10; } return sum==n; } };