in statement: currentsum= cum[j]-cum[i-1] for i =0 cum[i-1] will become cum[-1] which will be wrong. and this code is given in the course video!!! please tell me what is wrong
Maximum subarry sum using cumulative sum
@sharmaharsh9944 Yes you should prevent negative indexes in the array as it may have some unexpected results depending on the compiler. But here it is not causing any error and taking cum[-1] as 0. It basically depends on the compiler.