what is the mistake in my code?
Minimum money needed
Hello @arjun1998 .
Your code was correct. but the ques says “The second line contains W space separated integers in which the i^th^ integer specifies the price of a ‘i’kg apple packet. A value of -1 denotes that the corresponding packet is unavailable”
I added the line n = k. to correct that, and it is now giving correct ans.
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.