Medium · Dynamic programming
Coin Change
You are given a list of coin values, coins, and a total, amount. Return the fewest coins that add up to exactly amount. If no combination makes it, return -1.
- You can use each coin value as many times as you like.
- An amount of 0 needs 0 coins.
- The coin values are all different, and each is at least 1.
coins = [1, 3, 4], amount = 6 → 2 (3 + 3)Record your take