0-N Knapsack 1 test case failing

My code is giving run time error in last test case. Could you please identify the error? https://ide.codingblocks.com/s/141444

I have exactly copied Prateek sir from his youtube webinar.

in the knapsack function make the dp array of dimensions 1001 X 1001

Thank you so much sir :slight_smile: