Given coin denominations and a target amount, return the number of unordered ways to make that amount using unlimited copies of each coin. This is the combinations version of the coin-change counting DP, and loop order is critical.
coins = denominations, amount = target
number of unordered ways to form the amount
Example 1:
Input:
coins = [1,2,3] amount = 4
Output:
4
Explanation:
The unordered combinations are 1+1+1+1, 1+1+2, 2+2, and 1+3.
Example 2:
Input:
coins = [2,5,3,6] amount = 10
Output:
5
Explanation:
There are 5 unordered ways to make 10.