Subset recursion

https://hack.codingblocks.com/contests/c/512/513

https://ide.codingblocks.com/s/52845

my order of output is not correct. how to make it in correct order??

you can store all the subsets in a 2D vector and sort every vector using sort(v.begin(),v.end()) and then print it

1 Like

@ayush9999723922
another approach would be to use set container in STL, insert the subsets in set and then just print them.
Hit like if you get it.
Cheers
HappyCoding :stuck_out_tongue:

1 Like

https://ide.codingblocks.com/s/52859
now my ans is in correct order but i still failed 2 test cases

plz check the code…

your code is correct bt you are not printing in correct order.

For
Input
3
3 2 1
3
Your output
3 and 2 1
Required Output
1 2 and 3

1 Like