Auxiliary 2d dp array
let dp = new Array ( K + 1 ) ; for ( i = 0 ; i < dp . length ; i ++ ) { dp [ i ] = new Array ( 2 ) ; } for ( i = 1 ; i < K + 1 ; i ++ ) { for ( j = 1 ; j < N + 1 ; j ++ ) { dp [ i ] [ j ] = 0 ; } }