I am not getting output for negative element.
Maximum subarray sum
@souravrao3110 The Kadane algo as taught in the video will not work if all elements are negative. In case all array elements are negative the Kadane algo will fail. So in that case return the least negative number. Least negative number will be the answer.
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.