# Count of Subset Sum

Let's solve the Count of Subset Sum problem using Dynamic Programming.

## Statement

Given a set of positive numbers `nums`

and a value `targetSum`

, count the total number of subsets of the given set whose sum is equal to the `targetSum`

.

Let’s say you are given a set = $\{$ $1, 2, 3, 4$ $\}$ and a target sum = $4$. The output will be 2 as the following subsets:

- $\{$ $1, 3$ $\}$
- $\{$ 4 $\}$

will add up to make the desired sum.

**Constraints:**

- $1\leq$
`nums.length`

$\leq 1000$ - $0\leq$
`targetSum`

$\leq 10^5$ - $0\leq$
`nums[i]`

$\leq 10^4$

## Examples

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.