I've been trying PALIN in Python, but I keep getting TLE. I think my technique is fast enough to be accepted in a faster language. The basic idea is to increment the middle digit, propagating carries to the left and the right if any.
I've tried coding this in two slightly different ways (the 'smallest' and 'smallest1' functions in my code) but both get TLE.
There are a number of solves for this one in Python, so can anyone help by sharing hints on making the code faster?
# Code removed after getting AC