Skip to content

Commit a6d5c71

Browse files
committed
Time: 0 ms (100.00%) | Memory: 8.5 MB (92.18%) - LeetSync
1 parent 3fcedeb commit a6d5c71

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
public:
3+
bool isPalindrome(int x) {
4+
if(x<0)
5+
return false;
6+
long rev = 0;
7+
int y=x;
8+
while(y>0){
9+
rev=rev*10+y%10;
10+
y/=10;
11+
}
12+
return rev == x;
13+
}
14+
};

0 commit comments

Comments
 (0)