Go through this problem (we will discuss this in class next week):
/**
* Problem Statement:
* You are given a list of coin denominations and a target amount.
*
* Your task: Count how many different ways you can make up that amount using unlimited coins from the list.
*
* You may use each coin as many times as you want.
*
* Input:
* An integer amount (amount ≥ 0)
*
* An array coins[] of positive integers
*
* Output:
* An integer representing the number of distinct combinations to make up the amount
*
* Examples:
* Example 1:
* plaintext
* Copy
* Edit
* coins = [1, 2, 5]
* amount = 5
* ✅ Output: 4
*
* ✅ Explanation:
*
* [1+1+1+1+1]
*
* [1+1+1+2]
*
* [1+2+2]
*
* [5]
*
* Example 2:
* plaintext
* Copy
* Edit
* coins = [2]
* amount = 3
* ✅ Output: 0 (you can’t make 3 using only 2s)
*/
You can reach out to me at ddjapri@ayclogic.com if you have any questions!
You can find class notes here.