A board has 2n+ 1 holes in a line, with n red pegs starting in the first n holes, followed by a gap, thenn blue pegs in the remainingn holes. The pegs may be moved either one hole forward into an empty hole or a peg of one color may jump over a peg of the other color into an empty hole on the other side. What is the fewest number of moves it takes to completely interchange the red and blue pegs?
The solution is written here:https://sumo.stanford.edu/old/smt/2007/Advanced%20Topics%20Solutions.pdf
But I can't understand the algorithem can you explain it?









