Given an array of non-negative integers and a target sum, return the number of subsets with that sum modulo 1e9+7. This is the standard GFG-style subset-sum counting problem and is ideal for understanding DP table transitions.
nums = array of non-negative integers, target = desired sum
count of subsets with sum target modulo 1e9+7
Example 1:
Input:
nums = [2,3,5,6,8,10] target = 10
Output:
3
Explanation:
The valid subsets include [10], [2,8], and [2,3,5].
Example 2:
Input:
nums = [0,0,1] target = 1
Output:
4
Explanation:
Each zero doubles the count of the valid subset [1].