add leetcode 9
This commit is contained in:
parent
53077439e6
commit
4985021976
9
leetcode/9.py
Normal file
9
leetcode/9.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Given an integer, return true if x is a palindrome
|
||||||
|
|
||||||
|
|
||||||
|
class Solution:
|
||||||
|
def isPalindrome(self, x: int) -> bool:
|
||||||
|
str_x = str(x)
|
||||||
|
inv_str_x = str_x[::-1]
|
||||||
|
int_inv_str_x = int(inv_str_x)
|
||||||
|
return x == int_inv_str_x
|
Loading…
x
Reference in New Issue
Block a user