Company: Ion Group_15july
Difficulty: medium
Maximum Sum of Array Problem Description Given two arrays, arr1 and arr2 , each of length n . In one operation, any two elements within a single array can be swapped. This operation can be performed any number of times. The goal is to find the maximum possible sum of i * (arr2[i] - arr1[i]) for all 1 after rearranging the elements within arr1 and/or arr2 . Since the maximum possible sum can be very large, return the value modulo (10^9 + 7) . Complete the function getMaxSumOfArray in the editor below. int getMaxSumOfArray(vector<int> arr1, vector<int> arr2) { // Complete the function below } Examples Example 1: Input: n = 4 arr1 = [2, 1, 3, 4] arr2 = [2, 3, 2, 4] Output: 7 Explanation: Some possible rearrangements and their resulting sums are shown in the problem statement. For instance, if arr1 is rearranged to [2, 1, 3, 4] and arr2 to [2, 3, 2, 3] , the sum is -3 . If arr1 is rearranged to [3, 1, 2, 4] and arr2 to [2, 3, 2, 3] , the sum is -1 . If arr1 is rearranged to [3,