题目描述
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 )
Your Task:
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 N^{th} Special Number.
Expected Time Complexity: O(LogN)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 10^{5}
输入格式
见题面
输出格式
见题面
样例输入
N = 6
样例输出
5