Finding the length of the frequency array
let z = a [ 0 ] ; for ( let i = 1 ; i < n ; i ++ ) { if ( a [ i ] > z ) z = a [ i ] ; } z = z + 1 ; let ff = new Array ( z ) ; ff . fill ( 0 ) ; for ( let i = 0 ; i < n ; i ++ ) {