Computer Science, asked by jonathangwapu72, 21 days ago

it can be done by making all elements equal in all sides ​

Answers

Answered by jolysanthosh57
0

Explanation:

Sort the array of Integers in increasing order.

Now, to make all elements equal with min cost. ...

If A[i] < K, Increment the element by K – A[i].

If A[i] > K, Decrement the element by A[i] – K.

Update cost of each operation performed.

Similar questions