You are a test setter. Given an array containing difficulty level of problems.

Return the number of ways to set a test given the following constraints:

1.Minimum 2 problems must be selected.

2.Total difficulty must be at least l and at most r.

3.Difference between most difficult problem and least difficult problem must be at least x.

please suggest a solution. Back tracking may work here. (I don’t know the exact constraints)