You are given a non-negative integer n. Using only arithmetic operations, your task is to return the number formed by reversing its digits.
The reversed number should not contain unnecessary leading zeros. For example, reversing 120 produces 21, not 021.
Input: n = 1234
Output: 4321
Explanation: Reversing the digits of 1234 produces 4321.
Input: n = 120
Output: 21
Explanation: Reversing 120 gives 021, which is represented as 21.
Input: n = 5
Output: 5
Explanation: A single-digit number remains unchanged when its digits are reversed.
Sign in to write, run, and submit your solution against the full test suite.