BNY interview question

print all permutation or an array