sample test case is passing but I get wrong answer in all test cases. please tell the mistake
Minimum_money_needed
Hello,
It is possible that the prices of the packets may not be in the increasing other as given in the sample test case.
Your code is not considering this case.
Example:
INPUT:
5 5
4 5 3 2 1
EXPECTED OUTPUT:
2
YOUR OUTPUT:
1
Hope, this would help.
but how is the answer 2,he needs to pay only 1 rupee for 5 kg bag…
yes, 1 is the correct output.
I understood the question wrong.
Check for this input:
6 5
5 4 3 -1 -1 1
EXPECTED OUTPUT:
12
YOUR OUTPUT:
7
I am marking this thread as resolved as you have not replied to it since 5 days.
off chance , you still have any doubt regarding the same, you can reopen it.
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.