Mubashir needs your help to equalize (make all array elements the same) an array.
Create a function that takes an array of integers arr and a constant c and returns minimum number of operations required to equalize the given array.
x to equalize the given array.carr = [1, 2, 2, 1, 2, 1, 2, 2, 2, 1, 1, 1], c = 2
equalize(arr, c) ➞ 4
You have chosen x = 1 (change all values of the array to 1)
[1, 2, 2, 1, 2, 1, 2, 2, 2, 1, 1, 1]
[1, 1, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1] -> Step 1
[1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1] -> Step 2
[1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1] -> Step 3
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] -> Step 4
N/A