Stores all Dp - states
let dp = new Array ( A + 1 ) ; for ( let i = 0 ; i < A + 1 ; i ++ ) { dp [ i ] = new Array ( B + 1 ) ; for ( let j = 0 ; j < B + 1 ; j ++ ) { dp [ i ] [ j ] = new Array ( arr . length + 1 ) ; for ( let k = 0 ; k < arr . length + 1 ; k ++ ) { dp [ i ] [ j ] [ k ] = 0 ; } } }