when we have all the input is negative -2 , - 1, -3 and I need to find out the maximum subarray sum how this is going to work
Kadane algo with negative input
@vatsal38 just check all the -ve case means?? in the above case -1 would the answer but kadance fail here so what should do handle the -ve case
in one pass you check if all the numbers are negative or not…
if all are negative, print the maximum of all number thats all…
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.