Hash map to store the occurrence of frequencies of characters
var hash = new Map ( ) ; for ( var i = 0 ; i < 26 ; i ++ ) if ( arr [ i ] != 0 ) { if ( hash . has ( arr [ i ] ) ) hash . set ( arr [ i ] , hash . get ( arr [ i ] ) + 1 ) else hash . set ( arr [ i ] , 1 ) }