You are given an integer array coins representing different coin denominations and an integer amount.
Return the minimum number of coins needed to make up that amount.
If it is not possible, return -1.
amountInput:
[1,2,5]
11
Output: 3
Input:
[2]
3
Output: -1
Print a single integer as output.
No submissions yet.
Discuss dynamic programming, optimal substructure, and bottom-up approaches.