Error in code when array is negative?

if input array is -5 -1 -3
then your code would return zero whereas it should return -1

hey @sharad1103 if you look at this implementation of the kadane’s algorithm the result is the least negative integer https://ide.codingblocks.com/s/190696 , wrong ordering of comparison insider the kadane’s algorithm might lead it to return 0.

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.