Skip to content

Commit 2ebd0a2

Browse files
committed
Time: 7 ms (72.93%), Space: 6.2 MB (48.25%) - LeetHub
1 parent e2753c8 commit 2ebd0a2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
bool isPalindrome(int x) {
4+
string str = to_string(x);
5+
bool ok = true;
6+
int n = str.size();
7+
for (int i = 0; i < n / 2; i++) {
8+
ok &= (str[i] == str[n - i - 1]);
9+
}
10+
return ok;
11+
}
12+
};

0 commit comments

Comments
 (0)