Knapsack Problem WA !!

I was attempting this question getting WA for the same. What’s wrong with the following solution.

I finally came up with this ( solution covering all the cases

1 Like

This is my final solution … Please help me with this

@admin123 @mugurelionut @likecs Please help me with the recent solution

I tried my best still not getting AC