Two arrays with number of operations required
if ( count [ i ] < E ) lessE . push ( E - count [ i ] ) ; else greaterE . push ( count [ i ] - E ) ; } greaterE . sort ( ) ; lessE . sort ( ) ; var mi = 1000000000 ; for ( var i = 0 ; i <= K ; i ++ ) {