document.write( "Question 287851: Ten pennies and ten nickels were arranged alternatively as PNPN...PN. A move consists of exchanging the position of two adjacent coins. What is the minimum number of moves needed to move all the pennies to one end,and all the nickels to the other end,i.e.,PPP...PN...NNN?\r
\n" ); document.write( "\n" ); document.write( "A 10 B 20 C 25 D 40 E 45
\n" ); document.write( "

Algebra.Com's Answer #208645 by drk(1908)\"\" \"About 
You can put this solution on YOUR website!
To understand this question it is helpful to look at smaller cases:
\n" ); document.write( "2 coins: pn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .0 moves
\n" ); document.write( "--------
\n" ); document.write( "3 coins:pnp -> ppn . . . . . . . . . . . . . . . . . . . . . . . 1 move
\n" ); document.write( "4 coins:pnpn -> ppnn. . . . . . . . . . . . . . . . . . . . . . 1 move
\n" ); document.write( "--------
\n" ); document.write( "5 coins:pnpnp -> ppnnp -> ppnpn -> pppnn . . . 3 moves
\n" ); document.write( "6 coins:pnpnpn . . . . . . . . . . . . . . . . . . . . . . . . . . .3 moves
\n" ); document.write( "--------
\n" ); document.write( "7 coins: pnpnpnp. . . . . . . . . . . . . . . . . . . . . . . . . . 6 moves
\n" ); document.write( "8 coins: pnpnpnpn. . . . . . . . . . . . . . . . . . . . . . . . . 6 moves
\n" ); document.write( "--------
\n" ); document.write( "9 coins: pnpnpnpnp. . . . . . . . . . . . . . . . . . . . . . . . .10 moves
\n" ); document.write( "10 coins: pnpnpnpnpn. . . . . . . . . . . . . . . . . . . . . . .10 moves
\n" ); document.write( "-----
\n" ); document.write( "Notice that the number of moves for each pair after the first will be triangular in nature: 0, 1,3,6,10 and so on.
\n" ); document.write( "So, 10 pennies will have 10 moves; ( A )
\n" ); document.write( "
\n" );