it is giving 1 wrong answer,if i change n to s in line 29 it gives me all correct,why is it to be given s…ideally we have n items so we should take input of value for n items then why does it work for s number of items only…we can choose any “n” number of items in final
0-1 knapsack dp
Hello @Vibhuti0206,
No, it is still giving wrong output even after changing n to s at line 29.
I have corrected your code:
Refer to the comments for better understanding.
Hope, this would help.
Give a like if you are satisfied.