StackAdapt interview question

Generate all permutations of given characters