Reverse Number - II

You are given a non-negative integer N.

Your task is to reverse the digits of N and print the resulting number.

Note : If the number ends with one or more zeros, those zeros will not appear at the beginning of the reversed number because leading zeros are ignored.

Example 1:

Input:

N = 421

Output:

124

Explanation:

The reverse of number 421 is 124.

Example 2:

Input:

N = 100

Output:

1

Explanation:

The reverse of number 100 is 001 but we will ignore the leading 0's.

Now Your Turn!

Pick the correct output for the given input

Input:

N = 405

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 <= 109

Hints

Frequently Occurring Doubts

0
class Solution {
public:
int reverseNumber(int N) {
// Write your logic here
}
};
Test Case

Input:

N