This is a recursive code of wine problem in dp.
Please help me with my code, please tell possible edits in my code to make it work
instead of return ans = max(ans, k);
return k;
it will work
Thanks!!
I have an issue that i used the same thing in coins problem but it didn’t worked. Can you please tell me when we need to make a new variable to store minimun ans…
here is my code for coin problem using recursion. https://ideone.com/w8QlzM
correct recursion call is
k = min(k, cal(n-coins[i]))+1;
+1 should come after cal function
after that it will give correct ans
ideally for others doubts you have to create a new thread
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.