Reach the number in minimum steps In this challenge, you are given a number x. You have to find the minimum number of steps required to reach x from 1. At a particular point, you have two choices:

1) Increment the number by 1.

2) Reverse the integer (remove leading zeros after reversing)

Input: n=42    
Output: 1&gt;2&gt;3&gt;4&gt;5&gt;6&gt;7&gt;8&gt;9&gt;10&gt;11&gt;12&gt;13&gt;14&gt;41&gt;42 **(15 steps)**


The minimum steps to reach 42 from 1 is 15. This can be achieved if we increment numbers by 1 from 1 to 14 (13 steps). After reaching 14 we can reverse the number which will give us 41 (1 step). From 41 we can increment number by 1 to reach 42(1 step). Hence the total number is 15 steps, which is then the minimum.

Note that if we reverse the number after reaching 12 or 13, we will not get the minimum steps.

1>2>3>4>5>6>7>8>9>10>11>12>21>22>23>32>33>34>35>36>37>38>39>40>41>42 (25 steps)

Input: n=16
Output: 1&gt;2&gt;3&gt;4&gt;5&gt;6&gt;7&gt;8&gt;9&gt;10&gt;11&gt;12&gt;13&gt;14&gt;15&gt;16 **(15 steps)**


In this case we have to increment the numbers until we get 16, which will give us a minimum of 15 steps.

Note:  Starting from 0 is also allowed, which will increase all output by 1.
Haskell, 82 73 bytes



r=read.reverse.show
f 1=0
f a=1+(minimum$f(a-1):[f$r a|r a&lt;a,mod a 10&gt;0])


Try it online!

Simplest recursion method.

-9 bytes thanks to Christian Sievers