adhoc
SPOJ Problem Set (classical) - The Next Palindrome
spoj adhocProblem: Please find the problem here. Solution: An adhoc problem. The key idea to solve this problem is to try to keep the left hand side as small as possible. For example, if the input is 1921, we can assert the answer is 1991. To see why, decreasing any digit on the right hand side must also decrease a digit on the left hand side, and with we decrease any digit on the left hand side, the number is less than 1900!