Data Structures & AlgorithmsHardTCS NQT Digital · Product Company SDE

Problem: The number of ways to make 15 using coins of values 2, 3 and 5, where the order of coins does not matter, is what value?

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

Correct answer: D. 7

Solutions of 2a + 3b + 5c = 15 in non-negative integers number 7. Ordered sequences give 77, dropping the 5-coin gives 3, and requiring each coin at least once gives 2.

More Coding Interview Problems questions

Exams that ask this topic