here is code
Test cases not passing
Modified Code
mistake is that the ans is not in sorted order
so save all permutation in vector and sort the vector
and then print
now it pass all testcases
here is code
mistake is that the ans is not in sorted order
so save all permutation in vector and sort the vector
and then print
now it pass all testcases