My code is not passing 1,2,3 test cases
ans should be in sorted order
so store all valid permutation in vector and sort it
see at above modified Code
i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course