Given the swap distance defined as in the question Counting the adjacent swaps required to convert one permutation into another (i.e. we have a string of characters, and the swap distance from a permutation of that string is the minimum number of "adjacent character swaps" needed to get back to the original string).
I want an algorithm to find the highest possible swap distance for a given string. Of course, we could enumerate all permutations and check the swap distances of each, but that is horribly inefficient. Is there a quicker way to do it?