Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Will brute force work for this problem? Think of something else.
Take some examples like 1234, 999,1000, etc and check their closest palindromes. How many different cases are possible?
Do we have to consider only left half or right half of the string or both?
Try to find the closest palindrome of these numbers- 12932, 99800, 12120. Did you observe something?