12 lines
286 B
Python
12 lines
286 B
Python
# Given an integer, return true if x is a palindrome
|
|
|
|
|
|
class Solution:
|
|
def isPalindrome(self, x: int) -> bool:
|
|
if x < 0:
|
|
return False
|
|
str_x = str(x)
|
|
inv_str_x = str_x[::-1]
|
|
int_inv_str_x = int(inv_str_x)
|
|
return x == int_inv_str_x
|