← 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?
- A.ways[0] = 1, because choosing no coins is one way
- B.ways[0] = 0, because there are no coins
- C.ways[0] = infinity
- 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 →