I'm trying to flip a triangle like this in the following image:
there are two constraints in flipping it:
1- flip it with the minimum circles moves
2- the circles is sliding from a place to another and can't jump over another circle.
3- the circle can move vertically or horizontally
4- the circle can move any number of steps horizontally or vertically and it will considered only one move, but it shouldn't jump over any other circle in its moving path.
The triangle can be of any size.
Can anyone tell me about an algorithm that can make this job e.g. divide and conquer or greedy algorithms