Leaderboard
Showing:
Handle Score
@Ibrahim Nash 5725
@blackshadows 5685
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
Complete Leaderboard
Reverse digits
School Accuracy: 55.75% Submissions: 933 Points: 0

Given N,  reverse the digits of N.
 

Example 1:

Input: 200
Output: 2
Explanation: By reversing the digts of number, 
number will change into 2.

Example 2:

Input : 122
Output: 221
Explanation: By reversing the digits of number,
number will change into 221.

 

Your Task:
You don't need to read or print anything. Your task is to complete the function reverse_digit() which takes N as input parameter and returns the reversed number.

 

Expected Time Complexity: O(Log(N))
Expected Space Complexity: O(1)

 

Constraints:
1 <= N <= 1015

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Reverse digits

Output Window