Data Structures & AlgorithmsModerateTCS NQT · Infosys

What is the minimum number of coins needed to make an amount of 18 using unlimited coins of denominations {1, 6, 10}?

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

Correct answer: B. 3

Greedy picks 10 + 6 + 1 + 1 = 4 coins, but three coins of 6 give 18 exactly. This denomination set is not canonical, so DP (or checking alternatives) is required.

More Coding Interview Problems questions

Exams that ask this topic