We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7335653 commit ec6a78eCopy full SHA for ec6a78e
palindromeNumber.py
@@ -0,0 +1,9 @@
1
+class Solution:
2
+ def isPalindrome(self, x: int) -> bool:
3
+ if (x < 0 or (x % 10 == 0 and x != 0)):
4
+ return False
5
+ rev = 0
6
+ while (x > rev):
7
+ rev = rev * 10 + x % 10
8
+ x = x // 10
9
+ return x == rev or x == rev // 10
0 commit comments