DP MIN COINS NEEDED


why is this code giving wrong output …plz correct it with proper explaination…

plz reply at the earliest…

@S19LPPP0202
intially you need dp[0] = 0;
and all other dp states as +INF, because these are not calculated.
if its already zero then min(dp[i], x) would always be 0.

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.