Given a sequence of numbers, print out all possible sets such that the sum is less than a number The problem has 3 inputs.

L: a list of all numbers

size: the size each set can be

max: the max sum amongst each set

The challenge is as follows:

Given L, size and max, construct as many sets from L such that the number of elements is size and the sum of each of the elements does not exceed max.

Examples:

func(L=[1,2,3,4], size=2, max=5) = [{1,2}, {1,3}, {2,3}, {1,4}]


Notice how each of the values in the outputted set are sum &lt;= max.

func(L=[1,2,3,4], size=3, max=6) = [{1,2,3}]

func(L=[1,2,3,4], size=3, max=5) = [{}] or empty list, whichever you want


Note that in the set you cannot have duplicated items. ie: {2,1} = {1,2}

Constraints on inputs:

L: 0 or more elements

size: 0 &lt;= size &lt;= len(L)

max: 0 or more

If a list has 0 items, then always return the empty set. 

If the size is 0, then always return the empty set.

If max is 0, it is possible that there are negative values in L, in which case the returned sets need not be empty.

Shorted bytes wins!
05AB1E, 6 bytes

.ÆêʒO@


Try it online!