Palindrome Number — Number Theory & Geometry

Decide whether a signed integer's decimal digits form a mirror of themselves, working from the digits, not from text.

Number Theory & Geometry · Easy

The problem

An assay office stamps the same serial number at both ends of an ingot, and an inspector reads one stamp from each end. Decide whether an integer reads the same forwards and backwards in ordinary decimal notation, working with its digits only.

The story

A state assay office stamps a serial number at both ends of every metal ingot, so one stamp is read left to right and the other right to left. Given a signed 32-bit integer serial, decide whether its decimal digits read the same either way. A negative number never does, because of its minus sign. Work from the digits themselves, not from text.

What to return

Constraints

Example

Input
x = 4554
Output
true

Solve it

More in Number Theory & Geometry

All algorithm problems