Skip to content

Commit 2dd6e53

Browse files
committed
Time: 76 ms (29.16%), Space: 14.3 MB (16.03%) - LeetHub
1 parent a88db59 commit 2dd6e53

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: palindrome-number/palindrome-number.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution:
2+
def isPalindrome(self, x: int) -> bool:
3+
tmp, rev = x, 0
4+
5+
if x < 0:
6+
return False
7+
8+
pop = 0
9+
while x != 0:
10+
pop = x % 10
11+
x = x // 10
12+
rev = rev * 10 + pop
13+
14+
if tmp + rev == tmp * 2:
15+
return True
16+
else:
17+
return False

0 commit comments

Comments
 (0)