I didnt understand how the tutor printed the subarry using left and right

its confusing
pls clear

hello @suryansh771
it is simple.
we are using left and right to store starting and ending index of max sum subarray.

so while running kadane if we r encountring sum whose sum is greater than our existing max sum then we are updating our max sum and as well as left and right pointer .


my ans is not matching with tutors ans pls check

@suryansh771

pls save ur code here ->


and then share the link with me

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.

https://ide.codingblocks.com/s/303620 pls tell me about left and right usesd in it

The left and right variables are used as marker to store the starting point and the ending point of the maximum sum subarray(you found out while iterating the array).
Dry run it with an example and you will get how it is actually working

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.