Exact Savings
Chef works at a restaurant where he gets paid $\char"20B9 X$ per hour. One day, he visits a gift shop where there are $N$ gifts. The price of the $i^{th}$ gift is $\char"20B9 A_i$. Each gift can be bought **at most once**. Currently, Chef has no money. So, he wants to find the **minimum** number of hours he needs to work at the restaurant such that he can save **exactly** $\char"20B9 Z$ after
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.
Sign in to chat with the tutor and save your progress.
Sign in to start