Partition Equal Subset Sum Problem
Partition Equal Subset Sum Problem — ExecCode Medium DSA Practice
Solve the Partition Equal Subset Sum problem on ExecCode. Free online medium DSA practice in DP. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Given an integer array nums, return true if you can partition it into two subsets with equal sum. Each element must go into exactly one subset. This is possible only when the total sum is even, and some subset sums to exactly total/2. Return false when no such partition exists.
Examples
Input nums = [1, 5, 11, 5]; Output true. Input nums = [1, 2, 3, 5]; Output false. Input nums = [2, 2, 2, 2]; Output true
Constraints
1 ≤ nums.length ≤ 200 1 ≤ nums[i] ≤ 100
Practice Partition Equal Subset Sum free on ExecCode. Browse DSA problems, topic map, and placement guides.