n
to an integer and store it as num
.num
is less than 10 or is 11, return num - 1
as a string, since the closest palindrome would be the previous number.a
by mirroring the first half of n
onto the second half.b
by decrementing the middle digit of n
(if it's not '0') and then mirroring the first half.c
by incrementing the middle digit of n
(if it's not '9') and then mirroring the first half.num
.num
. In case of a tie, choose the smaller palindrome.