Maximum subarray sum 2 --> out of bound error

bhaiya has taken cumSum[ j ] - cumSum[ i - 1]; But i started from 0 so should we not get the error…

for(int i = 0; i < n; i++){