Declaring the DP table
let F = new Array ( MAX ) ; for ( let i = 0 ; i < MAX ; i ++ ) { F [ i ] = new Array ( MAX ) ; for ( let j = 0 ; j < MAX ; j ++ ) { F [ i ] [ j ] = new Array ( MAX ) ; for ( let k = 0 ; k < MAX ; k ++ ) { F [ i ] [ j ] [ k ] = - 1 ; } } }