If all the array elements are negative, then kadane’s algorithm will fail giving maximum subarray sum as zero
If all array elements are negative
Yes. 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.