Update indices of X , Y , Z ;
for ( var i = 0 ; i < n ; i ++ ) { if ( mp . hasOwnProperty ( s [ i ] ) ) { mp [ s [ i ] ] . push ( i ) ; } else { mp [ s [ i ] ] = [ ] ; mp [ s [ i ] ] . push ( i ) ; } }