81. Partition Equal Subset Sum

Can nums be split into two subsets with equal sums?

Example 1

Input: nums = [1,5,11,5]
Output: true
Explanation: [1, 5, 5] and [11].

Example 2

Input: nums = [1,2,3,5]
Output: false
Hint 1

If the total is odd, the answer is no.

Hint 2

Otherwise: is there a subset summing to total / 2? That is 0/1 knapsack.

Dynamic ProgrammingKnapsack