but what if all the elements in the array will be negative.
Kadane's algo(max subarray sum)
For kadane’s algo to work atleast one element need to be positive… So it wont work when all elements are negative…
but what if all the elements in the array will be negative.
For kadane’s algo to work atleast one element need to be positive… So it wont work when all elements are negative…