Let = sum of numbers with + sign, = sum of numbers with. Sign. You know: and . Add these equations: , so . If this isn't an integer, return 0.
Now the problem becomes: count subsets that sum to . That's subset sum with counting instead of boolean. The transformation is complete. You're selecting which numbers get the + sign.