Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
Coins of denominations [2, 12, 13, 21] are available in unlimited supply. What is the minimum number of coins needed to pay exactly 48?
- A. 3
- B. 10
- C. 4
- D. 5
Correct answer: C. 4
The greedy rule (largest coin first) is optimal only for canonical coin systems. Here a dynamic program over amounts finds a smaller coin count than greedy. The number of ways to pay is a different question.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- Coins of denominations [2, 3, 15, 21] are available in unlimited supply. What is the minimum number of coins needed to pay exactly 33?
- Coins of denominations [2, 9, 21] are available in unlimited supply. What is the minimum number of coins needed to pay exactly 57?
- Coins of denominations [2, 9, 12] are available in unlimited supply. What is the minimum number of coins needed to pay exactly 32?
- Coins of denominations [2, 10, 17] are available in unlimited supply. What is the minimum number of coins needed to pay exactly 50?
- Coins of denominations [2, 7, 11, 13] are available in unlimited supply. What is the minimum number of coins needed to pay exactly 58?
- Coins of denominations [2, 9, 15, 17] are available in unlimited supply. What is the minimum number of coins needed to pay exactly 57?