Subset Sum I
Subsequences Pattern DSA practice problem on Onlearn.
Difficulty: medium.
Topics: Print all possible subset sums of an array in increasing order, Recursion, Arrays, Sorting, Time Complexity, Space Complexity, Subsequences, complexity analysis, sorting algorithms, backtracking, combinatorics, recursion, Subset & Permutation Problems, Time & Space Complexity Analysis.
Given an array of integers, find all possible subset sums and return them in increasing order. Input Specification: The first line contains an integer N, the size of the array. The second line contains N space separated integers, representing the elements of the array. Output Specification: Print all the subset sums in a single line, separated by spaces, in increasing order. Sample Test Cases: Example 1: Input: 3 5 2 1 Output: 0 1 2 3 5 6 7 8 Example 2: Input: 3 3 1 2 Output: 0 1 2 3 3 4 5 6