Minimum Types
There are $N$ different types of coins. The $i$-th type of coin is worth $A_i$ dollars, and you have $B_i$ coins of this type with you. There is an item with cost $X$ that you'd like to buy. What's the minimum number of **distinct types** of coins you need to use to buy it? **You are allowed to pay more than $X$ to buy the item: you need not pay exactly $X$.** If it's not possible to buy the i
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