
Given an integer amount and a list of integers coins representing coin denominations, return the minimum number of coins needed to make up that amount. If that amount cannot be made up by any combination of the coins, return -1.
Example 1:
Input: amount = 11, coins = [1, 2, 5]
Output: 3
*Explanation: 11 can be made with 5 + 5 + 1.
Example 2:
Input: amount = 3, coins = [2]
Output: -1
*Explanation: It is not possible to make amount 3 with coin 2.
0 <= amount <= 10^41 <= coins.length <= 121 <= coins[i] <= 10^4amount = 11, coins = [1, 2, 5]Output3WhyUsing two 5s and one 1 makes 11 with 3 coins.amount = 3, coins = [2]Output-1WhyIt's impossible to form 3 with only coin 2.0 <= amount <= 10^41 <= coins.length <= 121 <= coins[i] <= 10^4def coin_change(coins, amount):