Max Sum of Subarray

ARRAY

Problem

Given an array of integers numbers and an integer size, find the maximum sum of any contiguous subarray of length size.

Examples:

maxSumSubarray([1,2,3,2,4,1,7,8,3], 3) // returns 18 // [7,8,3] is the subarray with the maximum sum.

Time complexity

This problem can be solved with a O(n) time complexity.

Loading...