Traverse the array w [ ] & update positions jumps array a [ ]
for ( int i = 0 ; i < n ; i ++ ) { if ( pos . containsKey ( w [ i ] ) ) pos . put ( w [ i ] , i ) ; else pos . put ( w [ i ] , i ) ; if ( filled . containsKey ( w [ i ] ) ) filled . put ( i , true ) ; else filled . put ( i , true ) ; if ( jump . containsKey ( w [ i ] ) ) jump . put ( w [ i ] , l [ i ] ) ; else jump . put ( w [ i ] , l [ i ] ) ; a [ i ] = w [ i ] ; }