Problem
You get an array nums of positive integers. Return true if you can split the items into two groups that have equal sums. Otherwise, return false.
Each item must go into exactly one of the two groups.
Example 1
- Input:
- nums = [3,1,4,2]
- Output:
- true
- Explanation:
- The groups
[3, 2]and[1, 4]both have the sum 5.
Example 2
- Input:
- nums = [2,3,7]
- Output:
- false
- Explanation:
- The total is 12, so each group needs the sum 6. No group of items adds up to 6.
Example 3
- Input:
- nums = [6,6]
- Output:
- true
Constraints
- 1 <= nums.length <= 200
- 1 <= nums[i] <= 100
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- Target Sum
Coding · 0-1 Knapsack · Array · Backtracking
- Last Stone Weight II
Coding · 0-1 Knapsack · Array · Dynamic Programming
- Coin Change
Coding · Array · Breadth-First Search · Complete Knapsack
- Partition Array for Maximum Sum
Coding · Array · Dynamic Programming
Sources · 2 references
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Google
Leetcode 416. Partition Equal Subset Sum
Reported Dec 25, 2024 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View source
LeetCode company tags · 1 record
Microsoft
Partition Equal Subset Sum
Reported date not specified · Source window: 30d
Source snapshot: Oct 20, 2026
Source frequency score: 61.5. This is not an interview probability.
View source