Regarding code written in this video

in this if the case comes like every element in the array is negative then, according to the code it will generate maxsum as 0 but answer should be minimum negative element present in the array.
for example consider an array to be -1, -2, -5, -3. Then according to code answer will be 0. But if we look to array then answer should be -1. Right??

Hey @captian_n3m01
correct.
that why u can write kadane algo as :

Please mark it as resolved ,if this resolves ur query :slight_smile:

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.