Introduction
This challenge is about counting the ways of making change for a given amount of money, using an array of distinct coins. The goal is to find the number of unique combinations that can be used to make the change.
This challenge is about counting the ways of making change for a given amount of money, using an array of distinct coins. The goal is to find the number of unique combinations that can be used to make the change.
Given an integer n and an array of distinct coins, write a function to count the number of ways of making change for n using the coins in the array. A coin can be used any number of times, and we are counting unique combinations.
For example, if n = 4 and coins = [1, 2], there are 3 ways of making change: 1+1+1+1, 1+2+1, and 2+2.
To solve this problem, you will need to:
Input: n = 4, coins = [1, 2]
Output: 3. 1+1+1+1, 1+2+1, 2+2, would be the ways of making change.
In this challenge, we learned how to count the ways of making change for a given amount of money using an array of distinct coins. By using dynamic programming, we were able to efficiently calculate the number of unique combinations.