1 Answers

In computer science, the maximum sum subarray problem is the task of finding a contiguous subarray with the largest sum, within a given one-dimensional array A of numbers. Formally, the task is to find indices i {\displaystyle i} and j {\displaystyle j} with 1 ≤ i ≤ j ≤ n {\displaystyle 1\leq i\leq j\leq n} , such that the sum

is as large as possible. Each number in the input array A could be positive, negative, or zero.

For example, for the array of values , the contiguous subarray with the largest sum is , with sum 6.

Some properties of this problem are:

5 views