##
Make all array elements equal with minimum cost
February 22, 2017

Given an array which contains integer values, we need to make all values of this array equal to some integer value with minimum cost where the cost of changing an array value x to y is abs(x-y). Examples: Input : arr[] = [1, 100, 101] Output : 100 We can change all its values to… Read More »