So the kodane's algo is only useful when the maxsum is positive? What if the maxsum comes out to be negative

So the kodane’s algo is only useful when the maxsum of subarrays is positive? What if the maxsum comes out to be negative.

Yes the Kadane algorithm taught in the course will not work when all elements are negative.
In that case answer will simply be the least negative number.
You can refer this video https://www.youtube.com/watch?v=YxuK6A3SvTs

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.