Getting wrong answer on all testcases

getting wrong answer on all testcases,checked on my self made test cases could not find a mistake,solved same type of question using this code

@Akshay0404 you have not applied logic for distinct permutations,your code give duplicates also.