PROJECT EULER · #0158
Lexicographical Neighbours
Taking three different letters from the
Examples are 'abc', 'hat' and 'zyx'.
When we study these three examples we see that for 'abc' two characters come lexicographically after its neighbour to the left.
For 'hat' there is exactly one character that comes lexicographically after its neighbour to the left. For 'zyx' there are zero characters that come lexicographically after its neighbour to the left.
In all there are
We now consider strings of
For every
What is the maximum value of
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.