Search⌘ K
AI Features

Solution: Partition Equal Subset Sum

Explore how to solve the Partition Equal Subset Sum problem using dynamic programming. Understand both naive and optimized approaches, including how to use a lookup table for bottom-up computation and reduce space complexity while deciding if an array can be divided into two subsets with equal sums.

Statement

Given a non-empty array of positive integers, determine if the array can be divided into two subsets so that the sum of both subsets is equal.

Constraints:

  • 11 \leq nums.length 200\leq 200
  • 11 \leq nums[i] 100\leq 100
...