why this takes 36 ms
class Solution:
def isPalindrome(self, x: int) -> bool:
s = str(x)
if (s == s[::-1]):
return True
else:
return Falseand this takes 64 ms even though they are quite similar and both on python 3
class Solution:
def isPalindrome(self, x: int) -> bool:
s = str(x)
return (s == s[ :: -1])