class Solution: def isPalindrome(self, x: int) -> bool: to_string = str(x) i = 0 q = len(to_string)-1 front = to_string[i] rear = to_string[q] while front == rear: if i==q or abs(i-q)==1: return True i += 1 q -= 1 front = to_string[i] rear = to_string[q] return False