Company: Ciena_11nov
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 value. Return the maximum possible array correlation value. Note: You are not allowed to rearrange the elements of the array a . Complete the function getMaxArrayCorrelation in the editor. The function expects to return a long int . It accepts the following parameters: a[n] : the fixed order array b[n] : the array to reorder Returns: long int : the maximum possible array correlation Examples Example 1: Suppose n = 5 , a = [1, 2, 3, 4, 5] , b = [3, 5, 4, 6, 2] . b can be rearranged to [2, 3, 4, 5, 6] . Now, for each index, the integers in b are greater than those in a . The array correlation is 2 + 3 + 4 + 5 + 6 = 20 . Example 2 (Sample Case 0): Input: 5 1 4 2 1 3 5 2 3 1 2 2 Output: 7 Ex