text: table [ i ] will be storing the number of solutions for value i . We need n + 1 rows as the table is constructed in bottom up manner using the base case ( n = 0 )
code: let table = new Array ( n + 1 ) ; table . fill ( 0 ) ;