Menu
CoddyTech

Palindrome Number

A number is a palindrome when it reads the same from left to right and from right to left.

121 is a palindrome. 123 is not, because backwards it reads 321.

A negative number is never a palindrome: -121 read backwards is 121-.

Try to solve it without turning the number into a string: build the reversed number digit by digit and compare.

Write a function named isPalindrome that gets an integer x and returns true if x is a palindrome, and false otherwise.

Constraints: -2^31 <= x <= 2^31 - 1

Function

isPalindrome(arg1: integer) → boolean
arg1integer
Returnsboolean

Examples

Input
arg1 = 121
Output
true

lock icon+8 hidden tests on Submit

Reset code
def isPalindrome(x):
    # Write code here
Test cases

Case 1

Case 2

Input

arg1 = 121

Expected

true