🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: 1D Dynamic Programming Patterns: all 10 questions

Quiz: 1D Dynamic Programming Patterns · Question 6 of 10

In "number of ways" coin change, swapping the loops (amount outside, coins inside) counts:

In "number of ways" coin change, swapping the loops (amount outside, coins inside) counts:

  1. A.the same thing, just slower
  2. B.ordered sequences, so 1 + 2 and 2 + 1 are counted separately
  3. C.only ways that use one coin
  4. D.the fewest coins
Answer & explanation

Correct answer: ordered sequences, so 1 + 2 and 2 + 1 are counted separately

With coins inside, every possible last coin is tried at each amount, so different orders become different ways.

Can you get the rest right without peeking?

Take the timed Quiz: 1D Dynamic Programming Patterns quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →