Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 447 Bytes

File metadata and controls

28 lines (21 loc) · 447 Bytes

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)