0-1 Knapsack DP problem


Please check into this code.
3 test cases are giving wrong ans.

@J20APPPP0005 try using n^2 approach , recursion approach takes 2^n time

but i have used dp here and its giving wrong answer not tle

Let me check it again. But till then check your base cases and try running few test cases on your solution.

did you find any mistake in the above code?

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.