The maximum sum sub-array is an array problem in competitive programming where we’re interested in finding the sub-array such that the sum of the elements of the sub-array is as large as possible.
The optimal solution to this problem is Kadane’s algorithm, with a time complexity of and space complexity of . The core idea is that: if a sub-array that ends at has a maximum sum, then the sub-array that ends at should also have the maximum sum (up to that point).