Challenge: Maximum Sum Subarray

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

Maximum subarray sum: An overview

Given an unsorted array AA, the maximum sum subarray is the subarray (contiguous elements) from AA for which the sum of the elements is maximum. In this challenge, we want to find the sum of the maximum sum subarray. This problem is a tricky one because the array might have negative integers in any position, so we have to cater to those negative integers while choosing the continuous subarray with the largest positive values.

Here is an example:

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy