MIMIMUM MONEY NEEDED PROBLEM https://ide.codingblocks.com/s/194812

getting test cases wrong https://ide.codingblocks.com/s/194812

Hello Faizan,
first remove all such weights whose cost is -1 .
because -1 indicates that that weight in not present.
and then apply ur logic.

https://ide.codingblocks.com/s/194862 still getting wrong answers

@Faizan-Ali-1395131367301898
fazan consider this case
-1 -1 -1 5
here 4th position i,e 5 means cost of 4 kg oranges is 5. so the way u r are removig -1 is incorrect.
use pair to store weight and costs. (ignore those weight which are having -1 cost)

for above case we have only one pair (4,5) where 4 is indicating weight and 5 is indicating cost to 4 kg weight

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.