Given an array nums and a target, assign a plus or minus sign to every number so that the final sum equals target. Return the number of different ways to do it. This is a classic subset-sum transformation problem.
nums = array of integers, target = desired final sum
number of sign assignments that produce target
Example 1:
Input:
nums = [1,1,1,1,1] target = 3
Output:
5
Explanation:
There are 5 ways to assign signs to get 3.
Example 2:
Input:
nums = [1] target = 1
Output:
1
Explanation:
Only +1 works.