Coding · should-tier · asked at Amazon, Apple, Google, Meta, Microsoft, Netflix
Partition Equal Subset Sum
Problem
Given a list of positive integers nums, decide whether it can be split into two groups whose sums are equal. Every element must go into exactly one group. Return True if such a split exists and False otherwise.
numsholds up to a couple hundred positive integers.- Each value is at most a few hundred.
Examples
nums = [3, 8, 4, 7]→True.{3, 8}and{4, 7}both sum to 11.nums = [2, 4, 9, 6]→False. The total is 21, which is odd, so no equal split exists.nums = [2, 3, 4, 7]→False. Total 16, but no subset sums to 8.
Hints
- If the two groups have equal sums, what does that say about the total, and what single number must one group add up to?
- The question becomes "is there a subset with sum
S". For each element, you either put it in that subset or you do not. - 0/1 knapsack over reachable sums: a boolean table
can[s]updated for each element withsiterated downwards.
Last reviewed 8 September 2026
Locked
Approach · Solution (Python) · Complexity · Follow-ups · Company variations · Tests
The rest of this question — the worked approach, the Python solution with passing tests, complexity, follow-ups and how each company frames it — is part of the guides.
Get the full guide
Pick the company you're interviewing with. Each guide has every question tiered for that loop — one-time purchase, lifetime access.
Secure payment by Stripe · instant access · refund questions: [email protected]
Also in: Apple, Google, Meta, Microsoft, Netflix
Interviewing at more than one? All 6 guides for $499 · save $395
Not ready to buy? Get the free starter pack — 13 questions with full solutions.