My code gives wrong answer for second test case

I think I’m making a minor mistake, can you help me correct it ?
My code :

@ayushjain.iitg
hello ayush ,
in line no 68,
it should be dp[i][j] = dp[i][j-1] | dp[i-a[j-1]][j];
rest of ur code and logic is correct

1 Like

oh yes, this means ki If i can’t make it using the current element of array, it might be possible to make it using only previous elements of array !!?
Well, this was a serious mistake, how did I passed the rest 2 tests :sweat_smile:

@ayushjain.iitg
test cases might be weak

1 Like