Challenge: Create an Amount
Explore how to solve the coin change problem using JavaScript by computing the number of ways to make a given amount with unlimited coins. This lesson helps you understand problem-solving techniques and algorithm design relevant to coding interviews.
We'll cover the following...
We'll cover the following...
Problem statement
Given an array of coins, write a function to compute the number of ways you can make that amount using those coins.
Note: There is an unlimited number of each coin type available.
Input
-
an
amount -
an array,
coins, containing different coins (in cents )
Output
- The number of ways to get the
amountusing thecoinsavailable
Sample input
amount = 4
coins = [1,2,3]
Here’s the amount all the coin values are given in cents ( ...