Minimum Increment and Decrement operations to make array elements equal

Reading time: 30 minutes | Coding time: 10 minutes


We are given an array, we need to find the minimum number of increment and decrement operations (by 1) required to make all the array elements equal.


Let us understand this problem with the help of an example:


We need to make the elements of this array equal : arr [] = {2,4,5,7,10}.


It is important to note here, that though we can make the array elements equal to any number in the array but we are asked to find out the minimum number of operati...

 •  0 comments  •  flag
Share on Twitter
Published on June 22, 2020 14:46
No comments have been added yet.