You are given an integer array A of size N and an integer K. prefix and suffix of the array with maximum sum such that the sum of the length of the prefix and suffix is exactly K. code example
Example: build a prefix array cpp
void fillPrefixSum(int arr[], int n, int prefixSum[])
{
prefixSum[0] = arr[0];
// Adding present element
// with previous element
for (int i = 1; i < n; i++)
prefixSum[i] = prefixSum[i - 1] + arr[i];
}