Fewest coins
hardProblem solving40 XP
You have coins of the values in coins, as many of each as you like. Return the fewest coins that add up to exactly amount, or -1 if it can't be done.
Examples
- Input: coins = [1, 2, 5], amount = 11Output: 3
- Input: coins = [2], amount = 3Output: -1
Examples use JSON: true/false/null are True/False/None in Python.