Initialize all entries of lookup table as not filled memset ( lookup , - 1 , sizeof ( lookup ) ) ;
for ( let k = 0 ; k < lookup . length ; k ++ ) { for ( let j = 0 ; j < lookup . length ; j ++ ) { lookup [ k ] [ j ] = - 1 ; } }