mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 23:07:08 +00:00
Time: 93 ms (46.30%), Space: 13.5 MB (11.60%) - LeetHub
This commit is contained in:
@@ -4,7 +4,6 @@ class Solution(object):
|
|||||||
:type x: int
|
:type x: int
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
"""
|
"""
|
||||||
#print(x)
|
|
||||||
# All negative numbers are not palindromes
|
# All negative numbers are not palindromes
|
||||||
if x < 0:
|
if x < 0:
|
||||||
return False
|
return False
|
||||||
@@ -18,8 +17,6 @@ class Solution(object):
|
|||||||
firstDigit = x / (10 ** currPower)
|
firstDigit = x / (10 ** currPower)
|
||||||
lastDigit = x % 10
|
lastDigit = x % 10
|
||||||
|
|
||||||
#print([firstDigit, lastDigit])
|
|
||||||
|
|
||||||
if firstDigit != lastDigit:
|
if firstDigit != lastDigit:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -27,7 +24,6 @@ class Solution(object):
|
|||||||
x -= firstDigit * (10 ** currPower)
|
x -= firstDigit * (10 ** currPower)
|
||||||
x /= 10
|
x /= 10
|
||||||
currPower -= 2
|
currPower -= 2
|
||||||
#print("after " + str(x))
|
|
||||||
|
|
||||||
# True if x is one digit (or widdled down to it)
|
# True if x is one digit (or widdled down to it)
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user