From the course: Fundamentals of Dynamic Programming

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

How many ways can you make change?

How many ways can you make change? - Python Tutorial

From the course: Fundamentals of Dynamic Programming

How many ways can you make change?

- [Instructor] Another problem where we would use dynamic programming is the change making problem. In the change making problem, we have certain types of coins called denominations. For example, let's say we're given these admittedly strange denominations of 19 cents, 12 cents, 5 cents, and 1 cent. Using as many of each denomination, we want to make it certain target value, say 16 cents. Let's make the rules clear. You're given a target t zero, and a set of denominations d sub i. You can use as many coins each denomination as want, as long as the total doesn't go above the target. And he want to minimize the number of coins you need to add up to t zero. There are some more assumptions that we should make to really formalize this problem. For example, the only way to guarantee we can always reach the target, is if one of the denominations is 1 cent. We'll just assume the problem works out. Let's go back to our…

Contents