OA | A question in OA of a fintech startup
Anonymous User
217

Question
Given an array and a number k, find the largest sum of the subarray containing at least k elements from the array. It may be assumed that the size of array is at least k.

Examples:
array=[1, 1, 1, 1, 1, 1]
k=2
output: 6

array=[-4, -2, 1, -3]
k=2
output: -1

array=[-3,1,5,-2,4]
k=3
output: 8

Comments (0)