text: Store the indices
code: for ( var i = 0 ; i < n ; i ++ ) { if ( mp . has ( arr [ i ] ) ) { var tmp = mp . get ( arr [ i ] ) ; tmp . push ( i ) ; mp . set ( arr [ i ] , tmp ) ; } else { mp . set ( arr [ i ] , [ i ] ) ; } }