Showing:
Handle Score
@Ibrahim Nash 6420
@mb1973 5646
@Quandray 5233
@akhayrutdinov 5111
@saiujwal13083 4716
@sanjay05 3762
@kirtidee18 3673
@marius_valentin_dragoi 3522
@sushant_a 3459
@verma_ji 3413
Special Numbers
Medium Accuracy: 46.29% Submissions: 518 Points: 4

A number is a special number if it’s digits only consist 0, 1, 2, 3, 4 or 5. Given a number N and we have to find N-th Special Number.

Example 1:

Input:
N = 6
Output: 5
Explanation: First 6 numbers are
( 0, 1, 2, 3, 4, 5 )


â€‹Example 2:

Input:
N = 7
Output: 10
Explanation: First 7 numbers are
( 0, 1, 2, 3, 4, 5, 10 )


You don't need to read input or print anything. Your task is to complete the function getSpecialNumber() which accepts an integer N and return Nth Special Number.

Expected Time Complexity: O(LogN)
Expected Auxiliary Space: O(1)

Constraints:
1 <= N <= 105

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?