207. Reverse a Number
Foundation1000 ms256 MBSolved by 0%
Print the digits of n in reverse order, as a number.
123 -> 321
120 -> 21
Note the second example. Reversing 120 gives 021, and as a number that is 21. Leading zeros disappear, and that is correct rather than a bug to fix.
Constraints - `0 ≤ n ≤ 1000000000`
Input
A single line containing one integer n.
Output
Print one integer, the digits of n reversed.
Input123
Output321
Noteis the plain case
Input120
Output21
Noteends in a zero, which becomes a leading zero and disappears
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution