Data Structures & AlgorithmsHardProduct company OA · Amazon/Microsoft-style OA

With coins of values 1, 3 and 4 (each usable any number of times), in how many ways (order does not matter) can you make the amount 6?

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

Correct answer: C. 4

Coin-change counting: iterate coins in the outer loop so each multiset is counted once. Looping amounts in the outer loop counts orderings instead, which is the classic mistake.

More Coding Interview Problems questions

Exams that ask this topic