https://ide.codingblocks.com/s/62376
i m not getting the correct answer
Minimum Money Needed234
Hi Aastha, first check the order in which the input is given. Secondly, do not copy paste codes from GeeksforGeeks. You should try to solve problems on your own. Moreover, the variable n given in input for this question is different than the n used in the code of gfg, so note the difference between the two. I’ve made minor modifications in your code, you can check them out here: https://ide.codingblocks.com/s/65757
The logic above does not given correct answer when the value of cost is negative, for example, consider the input:
5 10
-1 33 -1 176 -1 46 -1 120 -1 300
So, modify the logic for such testcases as well.
pls can you explain the problem that each packets is distributed among all the friends
can we choose the no 1 packets as many times,
yes we can take one packet multiple times…it is kind of unbound knapsack