Maximum (or minimum) sum of subarray of size k

Given an array of n integers, find the sub-array of length k with maximum sum. For example, Input Array: {6, 4, 3, 5, 1, 9, 2} k:3 Output: 15 (sum of sub-array 5, 1, 9) Solution: The brute-force solution for this problem is to find sum of all the sub-arrays of length k, and return […]
 •  0 comments  •  flag
Share on Twitter
Published on February 11, 2018 02:44
No comments have been added yet.