DP [ i ] [ j ] : Stores total number of ways to form the sum j by either selecting ith element or not selecting ith item .
var dp = Array . from ( Array ( N ) , ( ) => Array ( sum + 1 ) . fill ( 0 ) ) ;