weights and two couriers, the first and the second. Each parcel must go to exactly one of them.
A split is **acceptable** if each courier carries a total weight of at least minimum.
Return the number of acceptable splits. Two splits differ if at least one parcel goes to a different courier. The couriers are distinguishable: handing a set to the first or to the second gives different splits.
The answer can be large, so return it modulo 10⁹ + 7.weights=[3, 1, 2], minimum=3 → 2
The total is 6, so each courier needs exactly 3. The first courier can take {3} or {1, 2}: two ways.
weights=[4, 4, 4], minimum=5 → 0
One courier always ends up with at most one parcel, i.e. at most 4. There is no way.
weights=[2, 2, 2, 2], minimum=3 → 6
Each courier needs at least two parcels, so the split is 2 and 2: any two of the four go to the first courier, giving 6 ways.
weights=[3, 1, 2], minimum=3
2
Run checks the first 3 tests in your browser. Submit checks all 74 tests on the server, hidden ones included.