Challenge 11: Maximum Sum Subarray

With the given an array, find the contiguous subarray with the largest sum.

Maximum subarray sum: An introduction

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, find the sum of the maximum sum subarray. This problem is trick because the array might have negative integers in any position. Therefore, you 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