Firstly maxsum should not be initialized with 0 right? It should be -infinity?
Second while calculating currentSum cumSum[i-1] should give error as i is starting from 0 in the loop.
Doubt in the video code
hi
yes for generalize case the sum should be intiated with - infinity
and the i=0 case have to handeled seperately
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.