dp [ i ] [ j ] is going to store true if sum j is possible with array elements from 0 to i .
bool * * dp ; void display ( const vector < int > & v ) { for ( int i = 0 ; i < v . size ( ) ; ++ i ) printf ( " % d ▁ " , v [ i ] ) ; printf ( " STRNEWLINE " ) ; }