Initialise
for ( let i = 0 ; i <= n ; i ++ ) { dp [ i ] = new Array ( 2 ) ; for ( let j = 0 ; j < 2 ; j ++ ) { dp [ i ] [ j ] = new Array ( k + 1 ) ; for ( let x = 0 ; x <= k ; x ++ ) dp [ i ] [ j ] [ x ] = 0 ; } }