Minimum Money Needed

I am not able to clear the test case. As per the hint video I tried to implement the top-down approach but can’t get the right answers. Please review my code.

Hello @nikhil015 how many test cases you are able to pass and what is the error it is showing?

Not a single case. It didn’t show any error.

Hello @nikhil015 what is the question that you are solving the code which is the there in the link which you have shared seemd to be for someother question.

My bad. Here is my code: https://ide.codingblocks.com/s/391646

Hello @nikhil015
5 10
-1 33 -1 176 -1 46 -1 120 -1 300
correct ouput should be 112.
but your code is not producing the correct result.
you have to see that.
Happy Learning!!

See this code for your reference:


if you have any doubt in this you can ask here:
Happy Learning!!

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.