Doubt in understanding logic

watched the video many times but not able to understand logic

This will happen way more frequently as you progress through harder problems. Just leave it for now, and try some simpler problems on dp, Come back to it again latter.

i have already solved min steps and fibonacci which more simpler problems i can do in which if doubt arises i can ask the TAs for help

Dp is way more overwhelming topic to be intimidated by a count of “2” problems solved for experience.
And you can ask us doubts any time you want, but if a dedicated detailed video made by bhaiya couldn’t help you, we hardly could. But obviously we will be happy to try.
So, what is it you don’t understand in Bhaiya’s explanation?

can u give a brief idea how calls are being made

Focus on the state tree bhaiya made at the very beginning,
There are three possible ways to reach a sum of 15 Rs.

  1. You already have 14 Rs. and you pick up a coin of Rs. 1.
  2. You already have 8 Rs. and you pick up a coin of Rs. 7.
  3. You already have 5 Rs. and you pick up a coin of Rs. 10.

Out of all these possibilities you want to choose the one which yeilds you minimum coins.
Thus recurrence, dp[15] = 1+min{dp[14],dp[8],dp[5]}
And in generality, dp[i]=1+min{dp[i-coins[j]]}, where dp[i]=minimum coins to have i Rs.

So calls simply would be standing on state i, call all the states i-coins[j], and take their minimum.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.