Company: Msci_30july
Difficulty: medium
Maximize Array Correlation Description For two arrays a and b of equal length n , the array correlation is the sum of the values b[i] over every index i where b[i] > a[i] . You are given two integer arrays a and b , both of length n . You may reorder the elements of b in any way you like. The elements of a must stay in the order given. Reorder b so that the array correlation is as large as possible, and report that maximum value. Complete the function getMaxArrayCorrelation , which takes the fixed-order array a and the reorderable array b and returns the maximum possible array correlation. Input Format The first line contains a single integer n , the size of array a . Each of the next n lines contains a single integer, the next element of a . The next line contains a single integer, the size of array b . It is always equal to n . Each of the next n lines contains a single integer, the next element of b . Output Format Print a single integer: the maximum array correlation that can be