← All problemsSign in

Gotta buy em all

Ash Ketchum wants to buy all the items in a Pokestore to beat the Gym Leader Brock. Ash has $N$ notes of Pokebucks in his wallet, where $i^{th}$ note has value **A[i]** . It is known that Pokebucks exist in the denominations of $5*10^i$ and $10^j$ , where $0 \leq i \leq 8$ and $1 \leq j \leq 9$ . that is : $ 5,10,50,100.....10^9$. There are M items in the shop ,where the $j^{th}$ item costs B[j]

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