Company: Google_8nov
Difficulty: medium
Maximise Sum Problem Description You are given the following: An integer array A of length N An integer K Task : For each index j such that 1 , determine the maximum sum that can be obtained by using at most K elements from the subarray A[1] to A[j] . Notes : Assume 1-based indexing. A subarray is a contiguous part of the array. For example, consider the array [1, 2, 3] . It has 6 subarrays: [1] , [2] , [3] , [1,2] , [2,3] , [1,2,3] Complete the function maxSubarraySum provided in the editor. This function takes the following 3 parameters and returns the answer: N : Represents an integer denoting the size of array A K : Represents the given integer K A : Represents an integer array A Input Format Note: This is the input format you must use to provide custom input (available above the Compile and Test button). The first line contains T denoting the number of test cases. T also specifies the number of times you have to run the maxSubarraySum function on a different input set. For each te