I want to write a function ContigSum(i,j) that calculates the sum of the contiguous elements a[i] through a[j], where i<=j and a[] contains positive and negative numbers.
Could you please tell me a time efficient solution to find maximized contiguous SUM in the array?