[Solved]Dynamic Programming C Example Given List 5 Integers 4 5 9 3 S 17 Output Yes 5 9 3 17 Q37298306
Dynamic Programming:
In c++,
For example, given a list of 5 integers 4, 5, 9, 3, and S=17, theoutput is yes, as 5+9+3=17
Given a list of n positive distinct integers ai, a2, …, an; a positive integer S decides whether there is a subset of the integer ai’s that add up to S, each of the number can only be used once. If the answer is yet, output the subset too. Show transcribed image text Given a list of n positive distinct integers ai, a2, …, an; a positive integer S decides whether there is a subset of the integer ai’s that add up to S, each of the number can only be used once. If the answer is yet, output the subset too.
Expert Answer
Answer to Dynamic Programming: In c++, For example, given a list of 5 integers 4, 5, 9, 3, and S=17, the output is yes, as 5+9+3=1… . . .
OR

