You are given an array of integers coins representing coin denominations and an integer amount.
Your task is to determine the minimum number of coins required to reach amount.
You may assume that:
Return the minimum number of coins needed. If the amount cannot be formed by any combination of coins, return -1.
coins = [1, 5, 10, 25]
amount = 11
2
The amount 11 can be made with one 10-coin and one 1-coin.
coins = [5, 10, 25]
amount = 3
-1
The amount 3 cannot be made with the given coin denominations.
coins = [1, 5, 10, 25]
amount = 0
0
Zero coins are needed to make an amount of 0.
coins = [1, 5, 10, 25]
amount = 11
2