@jonocarroll
Just came across your blog post, here's my Julia solution:
```
maxmin(n::Integer) = maxxie(n), minnie(n)
function firstdigitswap(n::Integer, f::Function)
n == 0 && return 0
digs = digits(n)
val, i = f(digs)
digs[i] = digs[end]
digs[end] = val
digits2num(digs)
end
digits2num(digs) = mapreduce((i, d)::Tuple -> d*10^(i-1), +, enumerate(digs))
maxxie(n::Integer) = firstdigitswap(n, findmax)
minnie(n::Integer) = firstdigitswap(n, digs -> findmin((d > 0 ? d : 10 for d in digs)))
```
@jonocarroll
Ah, this is what happens when I read and code with 4am brain 😄 This just swaps the first digit with the max/min (non-zero) digit, which gives the same result in many cases, but fails for numbers like 92484957 (maxxie should return 99484257, returns with no swaps instead).
@digital_carver the swapping could be any pair of digits, unless it makes the first digit 0. This just swaps the ends, right?