How was the final sub array printed at end;

dear sir ,
i couldn’t understand the logic behind
i=-1;
j=-1;
left = i
right = j

for(k=left;k<=right;k++)

@tejas1801 This is a simple kadanes algorithm. Instead of only checking the sum of largest subarray. You have to update left and right variable for the subarray.

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.