Reverse Integer

Easy
Math Math

Given a signed 32-bit integer x, return x with its digits reversed. Return 0 if result overflows.

Constraints

-2^31 ≤ x ≤ 2^31 - 1

Examples

Example 1:
Input: 123
Output: 321
Example 2:
Input: -123
Output: -321
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.