in reply to Recursion problem
Recursion always involves two cases - a rather simple base case, and the recursive case.
In the base case you decide if the problem is solved. So, what really simple case can you think of where the problem is solved?
The to the recursion case: In your example the problem has a solution if the problem ((21 - 5), (-6, 8, 10, 12, 3, 10)) or the problem ((21 - (-6)), (5, 8, 10, 12, 3, 10)) or the problem ((21-8), (5, -6, 10, 12, 3, 10)) ... has a solution.
Now try to express that in perl ;-)
|
|---|