133. Reverse an Integer
EasyDigits
Reverse the digits of n, keeping the sign. Leading zeros in the result disappear (120 → 21).
Input format
A single integer n.
Output format
The reversed integer.
Example 1
Input
123
Output
321
Example 2
Input
-123
Output
-321
Constraints
|n| ≤ 10¹⁸
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…