The computational problem of sorting by reversals demands instead that we provide a minimum list
of reversals transforming one permutation into another.
As a result, sorting by reversals subsumes the calculation of reversal distance:
once we have a minimum collection of reversals, the reversal distance follows immediately.
Problem
A reversal of a permutation can be encoded by the two indices at the endpoints of the interval that
it inverts; for example, the reversal that transforms (4,1,2,6,3,5)
into (4,1,3,6,2,5) is encoded by [3,5].
A collection of reversals sortsπ into γ if the collection contains
drev(π,γ) reversals, which when successively applied to π yield
γ.
Given: Two permutations π and γ, each of length 10.
Return: The reversal distance drev(π,γ), followed by
a collection of reversals sorting π into γ. If multiple collections of such
reversals exist, you may return any one.