Why you have assigned the left and right value=-1

i not able to understand why sir have assigned the left and right =1; actually why it is used.

because if array is
-1 -2 -3
then for this ans should be 0 and subarray is empty subarray
so to also include this we have don that
if left and right value==-1 then empty subarray is ans

But if we are talking about the maximum sum then ans should the sum of - 1 - 2 - 3will be - 6. Why we are putting sum 0.

which one is maximum 0 or -6
:slight_smile:

hi @Abhishmu5

i hope you got now

Understood sir, thank u

1 Like

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.