Jaheim is obsessed with keeping shapes together. The refrigerator in his house has magnets of two shapes on the door: green squares and blue circles.
Jaheim wants all squares together and all circles together.
Someone has messed up the magnets.
How many swaps will it take Jaheim to restore order?
- A swap is where you swap the positions of a square and a circle.
- It doesn’t matter whether squares are on the left or the right: choose whichever one that will lead to the smallest number of swaps.
- In a swap the square and the circle do not have to be side by side.