Code is mistaken

as you are acessing cumsum[-1] ,so the code is wrong ,it would give seg fault on higher platforms.

Hey Tushar, can you please mention which problem you are talking about, or share the link to the respective code here.

1 Like

cpp 2 maximum subarraysum video code

Hey Tushar, the code is absolutely fine as we are not using the value of left and right before assigning them the values left = i and right = j in line 35 and 36.

in the nested loop , I am talking about . there cumsum[j]-cumsum[i-1] , so when i=0 it would be a problem

Hey Tushar, yes you are right… we will rectify it soon, for the correct version of this code you can check the same link shown in the video.

1 Like

ya please upload the correct video , I just joined course yesterday.
Actually in that code it is working properly but it would fail in most of compilers and give segementation fault. because negative index cant be accesed in C++ although it is possible in python

Update it please soon the error

Its 5 months i guess and it is not corrected yet. Actually due to college i stopped watching course and as now i opened and found doubt and video yet not rectified