Negative Array Index in the lecture Maximum Subarray Sum 2

In the main loop where you are trying to compute the current sum, it’s written “currentSum = cumSum[ j ] - cumSum[ i - 1 ]”, and the loop for i starts from i = 0, so this program will not work as cumSum [ i - 1 ] will be cumSum [ - 1 ] which is not accessible. Isn’t it?

@akashmodak97 hey akash you’re right there is little mistake in the code I will send the right code.

Yes already fixed it! Thanks :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.