Kadane's algorithm

What if all the elements in the given array is negative. In that case will cs and ms both will be zero?

hey @Ashish07
U can make little bit changes in it to consider negatives also

Initalize maxsum as INT_MIN
And in loop before checking for sum<0 add statement to check max