Submission Detail

11511 / 11511 test cases passed.
Status:

Accepted

Runtime: 144 ms
Memory Usage: 13.5 MB
Submitted: 1 week, 1 day ago
loading
Runtime Error Message:
Last executed input:
Input:
Output:
Expected:

Accepted Solutions Runtime Distribution

10
20
30
40
50
60
70
80
90
100
1
2
3
4
5
python
Runtime (ms)
Distribution (%)

10
20
30
40
50
60
70
80
90
100
2
4
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

13000
12600
12700
12800
12900
13100
13200
13300
13400
5
10
15
20
25
30
35
python
Memory (KB)
Distribution (%)

13000
12600
12700
12800
12900
13100
13200
13300
13400
10
20
30
Zoom area by dragging across this chart

Invite friends to challenge Palindrome Number


Submitted Code: 1 week, 1 day ago

Language: python

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
d = 0;
digits = []
if (x < 0):
num = x * -1
else:
num = x
# determine number of digits in the number
while (round(num / (10**d)) != 0):
d += 1
if (d == 0):
return True
# separate the digits and store in a list
for i in range(d-1,-1,-1):
res = int(math.floor(num / (10**i)))
num = num % 10**i
digits.append(res)
# make first element in list a negative sign if x is negative
if (x < 0):
digits.insert(0,'99')
# iterate through list and compare digits
a = 0
b = len(digits)-1
while (a < b):
if (digits[a] != digits[b]):
return False
a += 1
b -= 1
return True
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX