You are given an integer array coins of coin denominations and an integer amount. Return the fewest number of coins needed to make up amount. If it cannot be made, return -1. You have an infinite supply of each coin.
Example
coins = [1, 2, 5], amount = 11 => 3 // 5 + 5 + 1
coins = [2], amount = 3 => -1
function CoinChange(coins: int[], amount: int) -> int
Found a bug? Or annoyed about something in the language? Tell us.