Submissions disabled: This deployment is running in read-only mode for safety. Code execution is not available here.
← Back to all problems
Easy

Palindrome Number

Updated Jan 31, 2026

Problem

Given an integer x, return true if x is a palindrome, and false otherwise.

An integer is a palindrome when it reads the same forward and backward.

Constraints

-2^31 <= x <= 2^31 - 1

Follow Up

Could you solve it without converting the integer to a string?

Examples

Example 1

Input: x = 121
Output: true
121 reads as 121 from left to right and from right to left.

Example 2

Input: x = -121
Output: false
From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.

Example 3

Input: x = 10
Output: false

Function Signature

def isPalindrome(self, x: int) -> bool

How to Submit

Implement a Solution class with a isPalindrome method.

Your method will be called with the input parameters and should return the answer.