Count of Subsets with Given Difference
Medium

Problem Statement

Count the number of subset pairs whose difference of sums equals the given value.

Examples

1Example 1
Input:
{ "nums": [ 1, 1, 2, 3 ], "diff": 1 }
Output:
3
2Example 2
Input:
{ "nums": [ 1, 2, 3, 4 ], "diff": 2 }
Output:
2
3Example 3
Input:
{ "nums": [ 2, 3, 5, 6, 8, 10 ], "diff": 4 }
Output:
3
Loading...

Sign in to Run Code and Submit