Next Palindrome

Given a number in the form of an integer array, you need to find out the next smallest palindrome number. Store this palindrome number in an array and return.

For eg. if input is {1, 2, 3, 4}, the output should be {1, 3, 3, 1}

Input format :

Line 1 : Size of input array

Line 2 : Array elements (separated by space)

Sample Input 1 :
4
9 9 9 9
Sample Output 1 :
1 0 0 0 1
Sample Input 2 :
5
1 2 9 2 1
Sample Output 2 :
1 3 0 3 1

Login to submit your solution

Fb dab53a1a64929320dc7425896aa73fd9e5512b6ab52e414ff5f3ebb5cecc73eb

Share Problem