amazon oa
This commit is contained in:
15
9-240525-pass/main.py
Normal file
15
9-240525-pass/main.py
Normal file
@@ -0,0 +1,15 @@
|
||||
class Solution:
|
||||
def isPalindrome(self, x: int) -> bool:
|
||||
s = str(x)
|
||||
if len(s) % 2 == 0:
|
||||
mid = len(s) // 2 - 1
|
||||
for i in range(mid):
|
||||
if s[i] != s[len(s) - i - 1]:
|
||||
return False
|
||||
return True
|
||||
else:
|
||||
mid = len(s) // 2
|
||||
for i in range(mid):
|
||||
if s[i] != s[len(s) - i - 1]:
|
||||
return False
|
||||
return True
|
Reference in New Issue
Block a user