← All problemsSign in

Birthday

BOB is planning to surprise his girlfriend MARLA on her birthday, so he chooses to get her multiple gifts. The issue now is that BOB has only W money with him to spend on the gifts. He goes to a gift shop and finds out N gifts each having impressing value as vi and price value as wi. Your task is to help BOB choose the gifts so that the sum of the impressing value over the chosen gifts is maximum.

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