kadanes algo is not right when the all input elements of array are negative , in that case answer will be always 0.
Kadane's algo (maximum sub array 3)
@shrayanand000 If you apply Kadane algo on an array of all negative numbers, it will give you 0 as the answer.
The condition for the Kadane’s Algorithm is that at least one element must be positive. If all elements are negative then the answer is simply the least negative number.
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.