← All problemsSign in

Coin Change Problem

4. Problem statement: Alice has p no. of 5 rupee coins and q no. of 1 rupee coins. He wants to purchase an item for amount r. The merchant wants him to provide exact change. Alice want to pay using minimum number of coins. How many 5 rupee coins and 1 rupee coins will he use? If exact change is not possible then display -1. For Example: If input is No.of 5 rupee coins(p)= 3, no.of 1 rupee coin

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