Hidden Reflex interview question

Q: Write the code for generating the next palindrome