Subsets of an interger array using backtracking

question–>
https://practice.geeksforgeeks.org/problems/subsets-1613027340/1/?category[]=Recursion&category[]=Recursion&problemStatus=unsolved&page=2&query=category[]RecursionproblemStatusunsolvedpage2category[]Recursion
code–>


it is not passing all testcases
first test case not passing is–>
9
5 6 6 10 3 4 6 6 4

hello @sheikhhaji18

a) dont sort ur array , it will change the array order and it will not match the required output format .
b) first generate all subset on given array (without changing its order) and store it in some array
and then in sort that array to make it in lex order.

How to sort 2d vector in stl ?

just call ur sort function on that vector

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.