Start with the sequence of coins as follows (where you can think of O as TAILS and X as HEADS; there are 14 tails and 15 heads)

XOXOXOXOXOXOXOXOXOXOXOXOXOXOX

Transform it to

XXXXXXXXXXXXXXXOOOOOOOOOOOOOO

using moves of the following sort:

Take two consecutive coins and move them to the end, or the beginning.

If I counted correctly, Charlie's solution took 39 steps.

Here is a simpler solution that only takes 20 steps.

a) Move the first XO to the end, then the first OX,

and continue alternating the first XO and

the first OX for a total of 13 moves

b) Move the last XX to the start, and repeat 6 more

times for a total of 7 moves.

c) We are all done in 20 moves. See picture below.

Can anybody do better?

XOXOXOXOXOXOXOXOXOXOXOXOXOXOX

>>

XOXOXOXOXOXOXOXOXOXOXOXOXOXXO

>>

XOXOXOXOXOXOXOXOXOXOXOXOXXOOX

>>

XOXOXOXOXOXOXOXOXOXOXOXXOOXXO

>>

XOXOXOXOXOXOXOXOXOXOXXOOXXOOX

>>

XOXOXOXOXOXOXOXOXOXXOOXXOOXXO

>>

XOXOXOXOXOXOXOXOXXOOXXOOXXOOX

>>

XOXOXOXOXOXOXOXXOOXXOOXXOOXXO

>>

XOXOXOXOXOXOXXOOXXOOXXOOXXOOX

>>

XOXOXOXOXOXXOOXXOOXXOOXXOOXXO

>>

XOXOXOXOXXOOXXOOXXOOXXOOXXOOX

>>

XOXOXOXXOOXXOOXXOOXXOOXXOOXXO

>>

XOXOXXOOXXOOXXOOXXOOXXOOXXOOX

>>

XOXXOOXXOOXXOOXXOOXXOOXXOOXXO

<< << << << << << <<

XXXXXXXXXXXXXXXOOOOOOOOOOOOOO