Dp array to memoized the value recursive call
let dp = new Array ( ) ; for ( let i = 0 ; i < 1000 ; i ++ ) { let temp = [ ] ; for ( let j = 0 ; j < 1000 ; j ++ ) { temp . push ( [ ] ) } dp . push ( temp ) }