0% completed
Given an array nums
containing n
integers, return the number of subsets having a sum equal to x
.
A subset can be any combination of numbers from the array, including an empty subset. However, you need to consider all possible combinations to determine the exact number of subsets with a sum equal to x
.
Example 1:
[1, 2, 3, 4, 5]
, x = 5
3
[5]
, [1, 4]
, and [2, 3]
.Example 2:
[2, 4, 6, 10]
, x = 16
2
[6, 10]
and [2, 4, 10]
.Example 3:
[7, -3, 2, 5, 1]
, x = 9
2
[7, 2]
and [-3, 7, 5]
.Try solving this question here:
.....
.....
.....