Palindrome Number
EasyMath
Given an integer x, return true if its decimal digits read the same from left to right as from right to left, and false otherwise.
Negative numbers are never palindromes: -121 read backwards is 121-.
Constraints
- -2,147,483,648 ≤
x≤ 2,147,483,647
Example 1
Input
x = 121
Output
true
Why:
121 backwards is 121.
Example 2
Input
x = -121
Output
false
Why:
Backwards it would be 121-.
Example 3
Input
x = 10
Output
false
Why:
10 backwards is 01.
Hints
Was this a good challenge?
- Solved by
- 0
- Submissions
- 0
- Accepted
- –