### For a triangle with five rows is it four?

Imagine a triangle of coins on a table so that the first row has one coin in it and the second row has two coins in it and so on. If you can only move one coin at a time, how many moves does it take to make the triangle point the other way?

For a triangle with two row it is one, for a triangle with three rows it is two, for a triangle with four rows it is three.

For a triangle with five rows is it four?

It takes 5 moves to make the triangle with 5 rows point the other way.

0 = a coin that has not been moved.
X = the old position of the moved coin
8 = the new position of the moved coin.

________X
_______X X
____8 0 0 0 8
_____0 0 0 0
____X 0 0 0 X
_______8 8
________8

For triangle of any number of rows, the optimal number of moves can be achieved by moving the vertically symmetrical coins i.e. by moving same number of coins from bottom left and right, and remaining coins from the top.

For a triangle with an odd number of rows, the total moves require are :
(N2/4) - (N-4) Where N = 4, 6, 8, 10, ...

For a triangle with even number of rows, the total moves require are :
((N2-1)/4) - (N-4) Where N = 5, 7, 9, 11, ...

## My Blog List

• Edwin van der Sar meminta manajer Manchester United untuk segera membangkitkan motivasi para pemain. Manchester United mengundang perhatian dari para manta...
• Closer to the eye of the shooter, this is because Preview is quite literally applying a filter to each individual page of the PDF you are saving. the proce...
• INTRA NIFTY *f**u**t**u**r**e*S FOR 29.10.09 Hi Friends, Happy to meet you all again. I am going to post my 98% accuracy Nifty *f**u**t**u**r**e*s Intrad...
• Do It Yourself *P**r**o**j**e**c**t* : Menyelenggarakan Multipoint Video Conferencing Menggunakan Skype Gubernur Sulawesi Selatan Berkomunikasi dengan Ti...
• A: There is nothing like Virtual Constructor. The Constructor can’t be virtual as the constructor is a code which is responsible for creating an instance o...
• The application server is run by the Computer Administration Group at the Mechanical Engineering Departmentt. One of the objectives of this course is to...
• इंडिक ट्रांसलिटरेशन गूगल ट्रांसलिटरेशन इंग्लिश शब्दों को हिन्दी में टाइप करने में मदद करता है। इसकी खासियत है के आप कोई भी हिन्दी शब्द का इंग्लिश स्पेलिंग ...
• Demo Requirements This session requires 1 machine (called Server1 in this document). Minimum Hardware Requirements: Server1 *Processor* 400Mhz *Memory...
• IE App Compat VHD - Time bomb 4/2009 Posted: 02 Jan 2009 01:18 PM CST VPC Hard Disk Image for testing websites with different IE versions on Windows XP ...
• CRACK THE INTERVIEW *What Is .NET?* .NET is a powerful object-oriented computing platform designed by Microsoft. In addition to providing traditional soft...