Coin Change (Minimum Coins)
00:00
AmazonGoogleMicrosoft
Find minimum number of coins needed to make up amount. You have infinite supply of each coin denomination. Return -1 if not possible.
Examples
Input → coins=[1,5,11], amount=15
Output → 3
Note: 5+5+5
Input → coins=[2], amount=3
Output → -1
Input → coins=[1], amount=0
Output → 0