# Subset Sum

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

## Statement

Given a set of positive numbers `arr`

and a value `total`

, determine if there exists a subset in the given set whose sum is equal to `total`

. A subset can be an empty set, or it can either consist of some elements of the set or all the elements of the set.

Let’s say you are given a set = {1, 2, 3, 7} and a total = 6. The output will be TRUE as the subset = {1, 2, 3} adds up to make the desired total (1+2+3) = 6.

**Constraints:**

- $1\leq$
`arr.length`

$\leq 1000$ - $0\leq$
`total`

$\leq 10^5$ - $1\leq$
`arr[i]`

$\leq 10^4$

## Examples

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