diff --git a/leetcode/9.py b/leetcode/9.py new file mode 100644 index 0000000..a23e56e --- /dev/null +++ b/leetcode/9.py @@ -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