Why we have to check weight[i-1] > j for the ith item ?
Why it should not be weight[i] > j as we are considering ith item not the i-1 th item.
Please clarify as I am having problem in understanding the indexing of dp array. I am not able to figure out when I need to take dp[n+1][m+1] and when I need dp[n][m].