Search topics...

Palindrome Number

easy
mathTime: O(log n)Space: O(1)Frequency: 4

Given an integer, determine whether it reads the same backward as forward without converting to string.

Example 1:

Input: x = 121
Output: true

Example 2:

Input: x = -121
Output: false
Explanation: Reads as 121- from right to left — not a palindrome.

Example 3:

Input: x = 10
Output: false
Explanation: Reads as 01 from right to left — not a palindrome.