JuniorMath
Palindrome Number
Given an integer x, return true if x is a palindrome, and false otherwise.
An integer is a palindrome when it reads the same backward as forward. Negative integers are not palindromes because the minus sign does not match when read backward.
Example 1
Input
x = 121Output
trueReading 121 from left to right and right to left gives the same number.
Example 2
Input
x = -121Output
falseReading -121 backward gives 121-, so it is not a palindrome.
Constraints
- -2^31 <= x <= 2^31 - 1