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
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console