Easy · Math
Reverse number
Given an integer n, return the integer formed by writing the decimal digits of |n| in reverse order with n's sign kept (leading zeros of the reversal disappear, so 1200 → 21 and −507 → −705).
Examples
Example 1
n = 1234Output: 4321
Example 2
n = -507Output: -705
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.