Data Structures & AlgorithmsModerateProduct-company MCQ pattern

In how many ways can 10 be made from coins of 2, 3 and 5 (unlimited supply, order does not matter)?

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

Correct answer: B. 4

The combinations are 2+2+2+2+2, 2+2+3+3, 5+5 and 2+3+5, so 4. Counting ordered sequences (permutations) would give a much bigger number; the DP loops over coins outside and amounts inside to avoid that.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic