Showing:
Handle Score
@Ibrahim Nash 5761
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4944
@saiujwal13083 4506
@sanjay05 3762
@marius_valentin_dragoi 3516
@sushant_a 3459
@verma_ji 3341
@KshamaGupta 3318
Find all distinct subset (or subsequence) sums
Medium Accuracy: 0.0% Submissions: 4 Points: 4

Given a set of integers, find distinct sum that can be generated from the subsets of the given sets.

Example 1:

Input: nums = {1,2}
Output: {1,2,3}
Explanation: Three distinict sum can be
calulated which are 1, 2 and 3.


Example 2:

Input: nums = {1,2,3}
Output: {1,2,3,4,5,6}
Explanation: Six distinict sum can be calculated
which are 1, 2, 3, 4, 5 and 6.


You don't need to read or print anything. Your task is to complete the function DistinictSum() which takes nums as input parameter and returns a list containing the distinict sum in increasing order,

Expected Time Complexity: O(n * sum) where sum = sum of all elements of nums.
Expected Space Complexity: O(n * sum)

Constraints:
1 <= length of nums <= 102

1 <= nums[i] <= 102

to report an issue on this page.

### Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?