Barclays Interview Question

String palindrome and permutation formula and generation