Company: Uber_14july
Difficulty: medium
Maximum Array Correlation Problem Description For two arrays a and b of equal length, the array correlation is defined as the sum of all values b[i] where b[i] is greater than a[i] . Given two integer arrays a and b of the same length, rearrange the elements of array b to maximize the array correlation. Return the maximum possible array correlation value. Note: You are not allowed to rearrange the elements of the array a . Function Description Complete the function getMaxArrayCorrelation in the editor with the following parameter(s): a[n] : the fixed array b[n] : the array to reorder Returns long int : the maximum possible array correlation Examples Example 1: Input: a = [1, 4, 2, 1, 3] b = [2, 3, 1, 2, 2] Output: 7 Explanation: The second array can be rearranged to b = [2, 1, 3, 2, 2] . b[i] > a[i] for indices i = 0, 2, and 3 . The array correlation is 2 + 3 + 2 = 7 . Example 2: Input: a = [1, 9, 4, 2] b = [8, 4, 5, 1] Output: 15 Explanation: The second array can be rearranged to b =