Company: Microsoft intern
Difficulty: medium
Array Equalization Operations There is an array A of N integers and two types of operations that can be performed on the elements of the array: Increment a single element of A, which costs C1; Increment two elements of A, which costs C2. The chosen elements need to be in different positions. What is the minimum total cost of operations that will make all elements of A equal? As the result may be large, return the last nine digits without leading zeros (in other words, return the result modulo 10⁹). Function Description int solution(int A[], int N, int C1, int C2); The function should return the minimum cost of equalizing the array (modulo 10⁹). Constraints N is an integer within the range [1..100,000] C1 and C2 are integers within the range [0..10,000] each element of array A is an integer within the range [0..50,000,000] Examples Example 1: Input: A = [1, 4], C1 = 15, C2 = 3 Output: 45 We may increment the first element three times. Example 2: Input: A = [2, 11, 11, 11, 12], C1 = 10,