I applied dp but still giving tle and run error in slove 2 fuction
hello @anubhavb11
store -1 in place of 0 in ur dp array and then try.
also declare ur dp array of size 1001 * 1001
a) check ur size of price and wieght array. it should be atleast 1000
b)third argument of memset should be sizeof(dp)
here it should be solvedp
1 Like
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.