Increment the frequency of the element by 1.
let a = 0 ; if ( mp . get ( arr [ i ] ) == null ) { a = 1 ; } else { a = mp . get ( arr [ i ] ) + 1 ; } mp . set ( arr [ i ] , a ) ; } for ( let i = 0 ; i < n ; ++ i ) {