Please enter your email address or userHandle.
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.
N = 6
Explanation: First 6 numbers are
( 0, 1, 2, 3, 4, 5 )
N = 7
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)
1 <= N <= 105
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.