Computer Science EngineeringHardISRO SC (CS)

The number of distinct combinations (order ignored) of coins from [2, 5, 3, 6] (unlimited supply of each) that sum to 10 is:

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

Correct answer: A. 5

Unbounded-knapsack counting DP d[i] += d[i-coin], iterating coins in the outer loop, gives 5.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic