← All problemsSign in

Chef and Fixed Deposits

CodeChefRating 1271Open on judge ↗

Chef wants to make a purchase. For this, he needs $X$ gold coins, but he has none at the moment. Chef has $N$ fixed deposits, the $i^{th}$ of which is worth $A_i$ coins. He wants to open the minimum number of these deposits so that he has at least $X$ coins. You have to tell Chef the minimum number of fixed deposits he must open in order to have $X$ coins, or say that this is impossible. ### In

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