Given an integer n, find the next closest palindrome.
Anonymous
- Start out with brute force, increment n until a valid palindrome is found. - Make a new palindrome by finding the middle digit, and rotate left/right halves to create a palindrome m when m > n
Check out your Company Bowl for anonymous work chats.