diff --git a/leetcode/9.py b/leetcode/9.py index a23e56e..40cbbbf 100644 --- a/leetcode/9.py +++ b/leetcode/9.py @@ -3,6 +3,8 @@ 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)