Convert array by taking positions from umap
for ( let i = 0 ; i < n ; i ++ ) arr [ i ] = umap . get ( arr [ i ] ) ; } function prletArr ( arr , n ) { for ( let i = 0 ; i < n ; i ++ ) document . write ( arr [ i ] + " " ) ; }