Does kadane’s algo work for all negative elements ?. If it does not work then how would I be able to find max subarray sum?
Kadane's algorithm?
@aman.tandon3096 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.
Hope this helps 
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.