Skip to main content

Practice · 3 of 5

Recursive Reverse

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** Print the decimal digits of n reversed (leading zeros of the result disappear: 1200 -> 21). Solve it **recursively**: no while/for over the digits. **Input:** One line: n (0 <= n <= 10^15). **Output:** One integer — n with its digits reversed. **Example:** 1200 -> 21.

Back to lesson: Practice: Recursion Problem Set