Search⌘ K

DIY: Coin Change

Explore how to implement a coin change solution that calculates the minimum number of coins required to make a given amount. Understand problem constraints and return values to prepare for coding interviews involving dynamic programming and greedy algorithms using JavaScript.

Problem statement

You are given an integer total and a list of integers called coins. The variable coins holds a list of m coin denominations and total is the total amount of money.

You have to find the minimum number of coins that can make up the ...