← All problemsSign in

Bob and Boxes

Bob is planning a trip, but there is one problem. Bob has N boxes of weight W1, W2, ..., WN. He is quite superstitious and wants to carry exactly K boxes with him as K is his lucky number. He also wants sum of weights of the K boxes to be in the range [L,R] only. What a stupid condition! Can you help Bob find number of ways he can choose exactly K boxes out of N available boxes such that sum of

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start