whats the error in this plz tell
Whats the error in this
Its not passing testcases
Sorry for d late reply @Namanjain123,
in ur maxvalue function,
else if(w[i-1]>c)
dp[i][j]=dp[i-1][j];
->here use w[i-1]>j since u r currently storing value if u had to take j kg.
after this change , ur code will pass all d test case.
Hope dis rresolves ur doubt
If u still have any queries u can feel free to post them here
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.