0-N Knapsack Problem

My code https://ide.codingblocks.com/s/73123 is passing one test case and failing 2.
Can you please point out the error?
Or please give an example of a case my code is failing in?

Hi
see here correct version
image

you are putting this condition in for loop as if the size_list is sorted, size_list is not in sorted order so any number can be less than i, so put it in a if else

Hit like if you get it!
Cheers!

1 Like