Kadane's Algorithm

Why Kadane’s Algorithm gives 0 when the Sum of Maximum Subarray is a negative number?

@Shivam01 this is the edge case for Kadane’s algo, so when all numbers are negative, simply return the greatest integer among all.

okky thanx for explaining the doubt

Corner Case -> When array size is 5 & elements of array are 4 5 -5 -8 -9.

hello @Shivam01

all elements are not negative so here kadane will work.