Skip to content

Latest commit

 

History

History

Count Numbers Less Than K

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Numbers of length N and value less than K

Try the problem

Given a set of digits (A) in sorted order, find how many numbers of length B are possible whose value is less than number C.

Example 1

Input:
0 1 5  
1  
2  

Output:  
2 (0 and 1 are possible)  

Example 2

Input:
0 1 2 5  
2  
21

Output:
5 (10, 11, 12, 15, 20 are possible)