cheetcode

110. Partition Equal Subset SumMedium

Decide whether an array can be split into two subsets with equal sum.

Given a non-empty array nums containing only positive integers, return true if the array can be partitioned into two subsets whose sums are equal.

Examples

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

Constraints

  • 1 <= nums.length <= 200
  • 1 <= nums[i] <= 100