Initializing all the values of dp [ i ] [ j ] [ k ] as 0
for ( let i = 0 ; i <= n ; i ++ ) { dp [ i ] = new Array ( m + 1 ) ; for ( let j = 0 ; j <= m ; j ++ ) { dp [ i ] [ j ] = new Array ( n + 1 ) ; for ( let k = 0 ; k <= n ; k ++ ) { dp [ i ] [ j ] [ k ] = 0 ; } } }