# Leetcode 416 - Partition equal subset sum

Given a non-empty array nums containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.

**Example:**

1 | Input: nums = [1,5,11,5] |

**Note:**

- This is a
`01 knapsack`

problem. - The DP formula is
`DP[j] = Math.max(DP[j], DP[j - weight[i]] + value[i])`

. - Remember to iterate
`num`

first. - Remember the inner loop must be in
`descending`

order.

1 | /** |