Given:
coins
amount
Return the minimum number of coins needed to make up the exact amount. Return -1 if impossible.
Constraints:
Examples:
// Example 1:
console.log(coinChange([1, 5, 10], 12));
// Output: 3
// Explanation: 12 = 10 + 1 + 1
// Example 2:
console.log(coinChange([2], 3));
// Output: -1
// Explanation: Can't make 3 with only 2's
// Example 3:
console.log(coinChange([1], 0));
// Output: 0
// Explanation: No coins needed for 0