dsa · medium

Partition Equal Subset Sum

GreyOrangeDynamic Programming

Return whether nums can be split into two subsets with equal sum.

Arguments

**Example:** [1,5,11,5]true ([1,5,5] and [11]).

Constraints

1 <= nums.length <= 200 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
[1,5,11,5]

Expected:
true

Example 2

Input:
[1,2,3,5]

Expected:
false

Open in the Dojo editor