Infosys Interview Question

to code smallest next palindrome and 3rd largest number