No same permutation

all test cases are failing what is wrong with this code? it is working just fine for given test case
is there any other approach?
code link : https://ide.codingblocks.com/s/213691

Hi @SWIFTY

You can simply approach this question using stl function of next_permutation.
Link : https://ide.codingblocks.com/s/213709

Hope it Helps.

Thank you for the help, but how to solve this problem using recursion?