Data Structures & AlgorithmsHardGATE CS · CAT · MBA placement

In how many ways can 100 paise be paid using coins of 1, 5, 10 and 25 paise, where the order of coins does not matter?

  1. A. 8577828731901
  2. B. 121
  3. C. 213
  4. D. 242

Correct answer: D. 242

Loop over coin types on the outside and amounts upward on the inside: each coin type is counted once and repeats are allowed, which is the unordered count. Looping amounts on the outside counts ordered payments and gives a much larger number.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic