Jane Street Interview Question

Riddle about palindromes and permutations