Challenge 3: Maximum Subarray Sum

In this lesson, we will solve the challenge of calculating the maximum sum subarray in a given array.

Maximum Subarray Sum

In an unsorted array, the maximum sum of a continuous subarray is the one who’s elements—when added together—give the largest possible sum. 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:

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