Paying up problem. I am getting wrong answer

PROBLEM - https://www.codechef.com/problems/MARCHA1

Can someone please provide me with a test case which fails in my code? OR any mistake in the code?

MY CODE FOR THE PROBLEM -
https://www.codechef.com/viewsolution/37401157

Try this test:
1
4 15
8
4
5
3
It should be Yes (8 + 4 + 3).

This is standard dp subset sum problem. Greedy won’t work here.

2 Likes

thanku bro :slight_smile: