Ad
  • Custom User Avatar

    Take a couple elements in a row. Say, from the 2nd to the 4th, [1, -3, 4]. Sum them, and you get 2.

    Find the largest such sum, and output it.

  • Custom User Avatar

    The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers:

    So, you have to take a part (can be all the array) which sum is the greatest. In the example, there is no way to get a value greater than 6. You can't skip values, they need to be contiguous.