Maximum subarray sum

In a given unsorted array of the size kk, the maximum sum of a continuous subarray is the one whose 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 of size kk.

Extreme cases

Have a look at the following extreme/boundary cases for a closer understanding of the problem.

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