Compiler Issue

How this code got accepted while I am not returning False for non palindrome positive numbers.?

def reverse(x: int) -> int:
        result = 0
        y = abs(x)
        static = pow(2,31)-1
        while(y > 0):
            digit = y % 10
            if (result)  > (static - digit) / 10:
                return 0 
            result = result * 10 + digit
            y = y // 10
        return result
    
class Solution:
    
    def isPalindrome(self, x: int) -> bool:
        if x < 0:
            return False
        if x == reverse(x):
            return True


Comments (0)