Amazon interview question

Greedy algorithm and the Palindrome sequence