The famous algorithm of contiguous subarray within a one-dimensional array of numbers that has the largest sum is called Kadane’s algorithm.
It looks for global maximum of positive sum on any sub-array, regardless of it’s starting position or it’s length. Numbers must be next or together in a sequence (without any number left out).


