add leetcode 9

This commit is contained in:
sangge-rockpi 2024-01-19 22:16:14 +08:00
parent 53077439e6
commit 4985021976

9
leetcode/9.py Normal file
View 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