Question: Subset Sum is an important and classic problem in computer theory. Given a set of integers and a target number, your goal is to find
Subset Sum is an important and classic problem in computer theory. Given a set of integers and a target number, your goal is to find a subset of those numbers that sum to the target number. For example, given the set {3, 7, 1, 8, -3} and the target sum 4, the subset {3, 1} sums to 4. On the other hand, if the target sum were 2, the result is false since there is no subset that sums to 2. The prototype for this method is: public static boolean canMakeSum(int setOfNums [] int targetSum) Assume that the array contains setOfNums. length numbers (i.e., it is completely full). Note that you are not asked to print the subset members, just return true/false. You will likely need a wrapper method to pass additional state through the recursive calls. What additional state would be useful to track
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
