Data Structures & AlgorithmsHardGATE CS · ICPC regional

What is the minimum number of coins needed to make 63 from the denominations 1, 5, 10, 21 and 25 (unlimited supply of each)?

  1. A. 3
  2. B. 4
  3. C. 5
  4. D. 7

Correct answer: A. 3

Greedy takes 25 + 25 + 10 + 1 + 1 + 1 = 6 coins, but 21 + 21 + 21 = 63 uses only 3. Coin change with a DP over amounts is needed for non-canonical systems.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic