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
Inputx = 121
Outputtrue
Reading 121 from left to right and right to left gives the same number.
Example 2
Inputx = -121
Outputfalse
Reading -121 backward gives 121-, so it is not a palindrome.

Constraints

  • -2^31 <= x <= 2^31 - 1

Asked at 35 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate