Problem Brief
Minimum Product Sum
NEW GRADOA
See Tiktok online assessment and hiring insights
Given an array of n integers, arr[n], rearrange them so that the following equation is minimized.
Image of this equation is temporarily shown in the following 👇 I will find a way to do this
Note: The equation uses 1-based indexing.
Function Description
Complete the function findMinimumSum in the editor below.
findMinimumSum has the following parameters:
int arr[n]: the array to optimize
Returns
long: the minimum sum of products from the array
1Example 1
Input
arr = [1, 10, 2, 7, 10, 6, 6]
Output
127
Explanation

One of the optimal rearrangements is arr = [10, 1, 7, 6, 6, 2, 10], producing the result 10 * 1 + 1 * 7 + 7 * 6 + 6 * 6 + 6 * 2 + 2 * 10 = 127.
Constraints
Limits and guarantees your solution can rely on.
1 ≤ n ≤ 2 * 10^51 ≤ arr[i] ≤ 10^5