Question: In the subset ( target , numberList ) problem, we were given a target number and a list of numbers called numberList and we determined

In the subset(target, numberList) problem, we were given a target number and a list of numbers called numberList and we determined whether or not there exists a subset of the numbers in numberList that adds up to the target value. Each number in the numberList could be used at most once. Now, we'd like to permit a number in the numberList to be used any number of times: 0,1, or more. Write a function called subsetRepeat(target, numberList) that returns True if there exists a way to choose numbers from the numberList, with repeated use of an item permitted. If there is no such solution, the function should return False. Here are some examples:
>>> subsetRepeat(5,[1,2])
True<-- For example, 5=1+2+2
>>> subsetRepeat(11,[6,2,7])
True<-- For example, 11=2+2+7
>>> subsetRepeat(11,[2,4,6])
False<-- There's no way to make 11 from 2's,4's, and 6's

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!