Skip to content

Files

Latest commit

5ac85a2 · Jun 8, 2018

History

History
This branch is 1 commit ahead of, 532 commits behind trekhleb/javascript-algorithms:master.

maximum-subarray

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 1, 2018
Jun 8, 2018
May 1, 2018
May 1, 2018

Maximum subarray problem

The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array, a[1...n], of numbers which has the largest sum, where,

Maximum subarray

Maximum subarray

Example

The list usually contains both positive and negative numbers along with 0. For example, for the array of values −2, 1, −3, 4, −1, 2, 1, −5, 4 the contiguous subarray with the largest sum is 4, −1, 2, 1, with sum 6.

References