https://ide.geeksforgeeks.org/Z8rWOCNx31
Please tell the mistake
Hey Gagan
Please modify your approach as per negative test cases as well.
Your code doesnβt work correct with them. Try and dry run it for negative cost you will get it!
Gagan if cost of a packet is -1 the u cant take that packet so u have to make a check wheather u can take a packet or not
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.