Please explain what are we exactly putting in dp[i][j] in the following code?

hello @sahilkhan2312000131

first of all what u r storing in ur dp table will vary from implementation to implementation.

now look at the recusion that u have framed for this problem

solve(i,j) -> find maximum profit when we are considering [i…n-1] part of array and we have j capacity available.

and whetever answer we receive from this function we are storing the same in our dp array right.
so value at dp[i][j] is nothing but maximum profit when array [i…n-1] is considered and capacity is j.

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.