Company: CoinSwitch_2Dec
Difficulty: medium
Weighted Cost Minimization Weighted Cost Minimization You are given two arrays: values and weights , each containing N positive integers. You need to transform all elements in the values array to a single common target number. Each transformation has an associated cost: changing values[i] by one unit costs weights[i] per unit change. Your goal is to determine the optimal target value that minimizes the total cost of making all elements equal. The total cost is calculated as the sum of |values[i] - target| * weights[i] for all elements. Return the minimum possible total cost. Function Description Implement the function minWeightedCost that finds the minimum total cost to make all array elements equal, considering the weighted cost of each transformation. Parameters N : An integer representing the number of elements in both arrays. values : An array/list of N positive integers representing the initial values. weights : An array/list of N positive integers representing the cost per unit c