Grokking Dynamic Programming Patterns for Coding Interviews
Back to course home

0% completed

Minimum Subset Sum Difference

## Problem Statement

Given a set of positive numbers, partition the set into two subsets with a minimum difference between their subset sums.

Example 1:

``````Input: {1, 2, 3, 9}
Output: 3
Explanation: We can partition the given set into two subsets where the minimum absolute difference
between the sum of numbers is '3'. Following are the two subsets: {1, 2, 3} & {9}.
``````

Example 2:

``````Input: {1, 2, 7, 1, 5}
Output: 0
Explanation: We can partition the given set into two subsets where the minimum absolute difference
between the sum of numbers is '0'. Following are the two subsets: {1, 2, 5} & {7, 1}.
``````

Example 3:

``````Input: {1, 3, 100, 4}
Output: 92
Explanation: We can partition the given set into two subsets where the minimum absolute difference
between the sum of numbers is '92'. Here are the two subsets: {1, 3, 4} & {100}.
``````

Constraints:

• `1 <= n <= 15`
• `nums.length == 2 * n`
• -10<sup>7</sup> <= nums[i] <= 10<sup>7</sup>

## Try it yourself

Try solving this question here:

Python3
Python3

. . .
Mark as Completed