Frequency array to store the frequency of the first character of every string in the array
let freq = new Array ( 26 ) ; freq . fill ( 0 ) ; for ( let i = 0 ; i < n ; i ++ ) freq [ arr [ i ] [ 0 ] . charCodeAt ( ) - ' ' . charCodeAt ( ) ] ++ ;