Largest Sum Subarray

Given an array, find the contiguous subarray with the largest sum.

Statement

Given an array, find the contiguous subarray with the largest sum. Return the largest sum. Remember that a subarray contains at least one number.

Note: A subarray is a contiguous part of an array.

Example

In the array below, the largest sum subarray starts at index 33 and ends at 66, which yields a sum of 1212.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.