Minimum money needed

Here’s my code for minimum money needed. I tried according to the hint video but still getting WA.

Hey @div_yanshu07 Check for this test case:
5 10
-1 33 -1 176 -1 46 -1 120 -1 300
Expected o/p is: 112
Yours is giving is 32767

That is the issue I did it using hint video but still getting WA

See input format carefully, you have to take array input of size W not of n. and take care of cases when array value is -1 as told in the input format. I am attaching my code, you can take it for reference

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.