Please check code for 0-1 Knapsack

Hello @sahilkhan2312000131 you are using 1d DP here?
can you explain your logic what made you solve this with 1 dp?

I am not able to calculate 2d do. Please help

@sahilkhan2312000131 have you seen the editorial for this?
the logic will be like:
we will make 2d ap array in which the two parameters will be capacity and value.
your logic is fine it just about the dp part which you were doing wrong.
here for your reference i am attaching the code;

if you dont understand anything in this you can ask here:
Happy Learning!!

hey @aman212yadav can you please explain what exactly are we putting in our dp at each step in this code.

bro this doubt is taken by another ta, pls raise another doubt , i will help u there

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.