Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

With coin denominations 1, 3 and 4, what is the minimum number of coins needed to make the amount 6?

  1. A. 3
  2. B. 2
  3. C. 6
  4. D. 4

Correct answer: B. 2

Greedy takes 4 + 1 + 1 for three coins, which fails here. The DP finds 3 + 3 with two coins, so the exchange argument fails for this coin system.

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

Exams that ask this topic