Here in case the sum at any stage appears to be negative we are making dp[i]=0 for that iteration. what do we do in case all the integers of the array are negative?
e.g. : In case the array is [-2,-1], the ans should be -1, but according to this code, it’s coming out to be zero.