Skip to content

Latest commit

 

History

History

Count all subsequences having product less than K

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given a non negative array, find the number of subsequences having product smaller than K.

Examples:

Input : [1, 2, 3, 4]

k = 10

Output :11

The subsequences are {1}, {2}, {3}, {4}, {1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 4}, {1, 2, 3}, {1, 2, 4}

Input : [4, 8, 7, 2]

k = 50

Output : 9