Https://ide.codingblocks.com/s/53898

Subsets - Recursion

Find all the subsets of a given array that sum to k.
Input Format:

The first line contains an integer N , the size of the array. The next line conatins N integers. The next line contains an integer K.
Constraints:

0 < N <= 20

Output Format:

Output all the subsets that sum to K. The output should be printed as follows :

Sets with least no of elements should be printed first.
For equal length, elements that appear later in the original set,should be printed first.

Sample Input:

5
1 4 6 5 3
10

Sample Output:

6 4
3 6 1
5 4 1

https://ide.codingblocks.com/s/53898
I am the getting the correct output but in reverse order.

Hey Aastha, to print the correct order of the output you can use a 2D array to store the output first and then print it after getting all the required subsets. you can refer this.