101. Reverse a number

You are given an integer n. Return the integer formed by placing the digits of n in reverse order.

Example 1:

Input: n = 25

Output: 52

Explanation: Reverse of 25 is 52.

Example 2:

Input: n = 123

Output: 321

Explanation: Reverse of 123 is 321.

Now Your Turn!

Pick the correct output for the given input

Input: n = 54

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 0 <= n <= 5000
  • n will contain no leading zeroes except when it is 0 itself.
0
class Solution {
public:
int reverseNumber(int n) {
 
}
};
Test Case

Input:

N