Back to DSA

Partition Equal Subset Sum

medium
Acceptance: 47%
Dynamic Programming

Determine whether an integer array can be split into two groups such that both groups have identical sums.

Examples

Example 1:
Input:nums = [3,3,3,4,5]
Output:true
Explanation: One valid split is {3,3,3} and {4,5}, both summing to 9.
Example 2:
Input:nums = [1,2,5]
Output:false
Explanation: Total is 8, which is even, but no subset sums to 4.

Hints

00:00
1234567