Coin Change

Medium

📝 Description

Compute the fewest number of coins needed to make up an amount

Input Format

Array of coin denominations and integer amount

Output Format

Minimum number of coins or -1

Constraints

1 ≤ coins.length ≤ 12 0 ≤ amount ≤ 10^4

🔍 Sample Input

[1,2,5]
11
            

✅ Sample Output

3
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run