Coin Change
You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.
Coin Change

You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.

Example 1:
Input: {"coins":[1,2,5],"amount":11}
Output: 3
Input
arr ={"coins":[1,2,5],"amount":11}

Init DP array with max values

Coins

1

2

5

DP (Min Coins for Amount)

0

0

1

2

3

4

5

6

7

8

9

10

11
Variables
VariableValue
amount11
dp[0]0
DepthFunction Call
Stack empty
0/95