Solvarch
DSA ProblemsProgressPlanRoadmapsReviewCheat SheetsCompaniesSystem DesignCS FundamentalsQuestion Bank
Theme
Problems

Partition Equal Subset Sum

Medium
dynamic-programmingknapsackarray

Return true if the array nums can be split into two subsets with equal sums.

Input: one line of space-separated positive integers. Output: true or false.

Example 1
Input:
1 5 11 5
Output:
true

[1,5,5] and [11].

Example 2
Input:
1 2 3 5
Output:
false

Constraints

  • 1 ≤ nums.length ≤ 200
  • 1 ≤ nums[i] ≤ 100
Watch a video walkthrough

Run your code against the sample tests, or Submit to run the full suite.