Although I have passes all the test cases, but i can’t get the intuition of how to apply dp in this ques. Can please check my code once if it is correct or not. Also suggest how to apply dp in this ques.
IDE : https://ide.codingblocks.com/s/203039
Subset sum easy
@aman2382000 You only apply DP on subset sum when the numbers are positive ,otherwise it is a NP complete problem.
If the numbers are positive, the problem is similar to 0-1 knapsack.
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.