0009. Palindrome Number
Easy | Math | 40 ms (93.69%), 13.2 MB (90.79%)
Source: LeetCode - Palindrome Number GitHub: Solution / Performance
Given an integer x
, return true
if x
is palindrome integer.
An integer is a palindrome when it reads the same backward as forward. For example, 121
is palindrome while 123
is not.
We could find the answer by reverting half of the number. For odd length, the middle digit could be ignored by // 10.
Last updated