🎙 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 10 of 10

What is the base value for counting ways to make amount 0 with coins?

What is the base value for counting ways to make amount 0 with coins?

  1. A.ways[0] = 1, because choosing no coins is one way
  2. B.ways[0] = 0, because there are no coins
  3. C.ways[0] = infinity
  4. D.It depends on the coins
Answer & explanation

Correct answer: ways[0] = 1, because choosing no coins is one way

Every way to make x with last coin c extends a way to make x − c; the chain must start from one empty way.

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 →