Back
Close

Solid Integer

Statement

 Goal

We call an integer solid if it is positive and we do not need to use the digit 0 to write it down in base 10.
For example, 115 is solid, but 10 and 1205 are not.
The 10th solid integer is 11 because the first 10 solid integers are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11.
For each value of n, you have to compute the nth solid integer.
Input
An integer n.
Output
The nth solid integer.
Constraints
0 <n< 2^63
Example
Input
10
Output
11

Tags
Number theory

Difficulty
Medium

Test cases
Starting Small Test
Input
10
Output
11

Starting Small Validator Validator
Input
12
Output
13

Medium Test Test
Input
100
Output
121

Medium Test Validator Validator
Input
120
Output
143

100k Test
Input
100000
Output
162151

100k Validator Validator
Input
200000
Output
334312

Smart Solution Test
Input
4503599627370496
Output
23776826742147167

Smart Solution Validator Validator
Input
4515945281747364
Output
23835563997839983

Output might overflow Test
Input
4611686018427387904
Output
33646585979948395414

Output might overflow Validator Validator
Input
4611686018439772669
Output
33646585979974672144

Single digit Test
Input
9
Output
9

Single digit Validator Validator
Input
1
Output
1

Another small Test
Input
89
Output
98

Another small Validator Validator
Input
90
Output
99

Another medium Test
Input
747
Output
919

Another medium Validator Validator
Input
6619
Output
8964

Another large Test
Input
531441
Output
888889

Another large Validator Validator
Input
578024
Output
969798

Solution language

Solution

Stub generator input