Initialize DP Table as - 1
for ( let i = 0 ; i < 500 ; i ++ ) { for ( let j = 0 ; j < 500 ; j ++ ) { for ( let l = 0 ; l < 500 ; l ++ ) dp [ i ] [ j ] [ l ] = - 1 ; } } return calculate ( 0 , 1 , n , k ) ; }