Find Array Given Subset Sums
A hard-tier problem at 49% community acceptance, tagged with Array, Divide and Conquer. Reported in interviews at Mindtickle and 0 others.
Find Array Given Subset Sums is a hard problem that asks you to reconstruct an original array from all its subset sums. It's the inverse of a subset sum problem, which makes it brutal. You're given a list of sums (potentially with duplicates) and need to figure out which array produced them. This problem appears in assessments at Mindtickle. With a 49% acceptance rate, most candidates either miss the core insight or get caught in implementation. If you hit this on a live OA and the pattern isn't clicking, StealthCoder surfaces a working solution in seconds while staying invisible to the proctor.
Companies that ask "Find Array Given Subset Sums"
Find Array Given Subset Sums is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderThe key insight is that if you sort the subset sums, the smallest sum is always 0 (empty set) and the second smallest is the minimum element of your target array. From there, you can use divide and conquer to recursively partition the sums. Once you identify a candidate element, remove it and its combinations from the remaining sums, then recurse. The trap is that a greedy approach fails: you can't just pick the smallest unclaimed sum and assume it's an element. You have to validate each candidate by checking if removing it (and all sums that include it) leaves a valid remainder. Array and Divide and Conquer are your toolkits here. Implementation bugs are common: off-by-one errors in multiset removal, forgetting to account for duplicates, or picking the wrong candidate when multiple are plausible. StealthCoder handles the fiddly bookkeeping that trips up live submissions.
Pattern tags
You know the problem.
Make sure you actually pass it.
Find Array Given Subset Sums recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Array Given Subset Sums interview FAQ
Is this problem actually asked in interviews, or is it just a competitive-programming outlier?+
It's rare but real. Mindtickle has reported asking it. The 49% acceptance rate shows it's not a filter-out problem, but it's hard enough that most candidates either crack it or run out of time. If you see it live, it's a signal that your interviewer is testing algorithmic depth, not pattern matching.
What's the trick I'm missing if the greedy approach doesn't work?+
Greedy fails because the second-smallest sum might not be a single array element; it could be a combination of smaller elements. You must validate each candidate element by attempting to reconstruct the rest of the array without it. This is where divide and conquer comes in: recurse on the remaining sums after removing the candidate and its sum combinations.
How do Array and Divide and Conquer connect here?+
You're building an array by recursively splitting the subset-sum list. Each recursion level identifies one element, removes all subset sums that include it, and recurses on what's left. The base case is when only the empty-set sum (0) remains. This is classic divide and conquer applied to array reconstruction.
What implementation details break most solutions?+
Multiset handling is the killer. You need to accurately remove sums when you claim an element, account for duplicates in both the array and the sum list, and validate candidates properly. Off-by-one errors in indexing and forgetting to check all plausible candidates before committing also derail submissions fast.
If I blank on this in a live assessment, what's the time-cost to recover?+
Without the pattern, you're looking at 20-40 minutes of debugging guesses. With StealthCoder, a correct implementation appears in seconds while the proctor sees only your screen. It's the safety net for the problem you didn't drill.
Want the actual problem statement? View "Find Array Given Subset Sums" on LeetCode →