Search topics...
All Problems

Palindrome Number

Solution Approach
Was this helpful?
EasymathExpected: O(log n) time, O(1) space

Problem

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.
Reference solution unlocks after your first submission
Loading...