Next Palindrome
Given a non-negative integer n, return the smallest palindrome strictly greater than n.
A palindrome reads the same forwards and backwards, for example 121, 1001, and 7. You must return the next palindrome after n, that is the smallest numeric palindrome p such that p > n.
Treating n as a decimal string, the answer can always be built by mirroring the left half onto the right half. If that mirrored value is still less than or equal to n, increment the left half and mirror again, producing a carry that grows the number when all digits are nines.
Because the value can be as large as 10^12, work with the decimal string rather than arithmetic increments in a loop.
Next Palindrome
Given a non-negative integer `n`, return the smallest palindrome strictly greater than `n`.