Always based on the android game BLOCK x3. The objective is to align the 1's in the matrix (7x7) using minimum movements. The valid movements are horizontal and vertical (by one step). A zero (0) indicates an empty space.
Your task is to count minimum number of movements required to align the FOUR 1's vertically or horizontally (it was only 3 blocks in problem 2451).
Beware to align the 4 blocks WITHOUT aligning 3 blocks before
If you move the second 1 to the left, you align 3 blocks and loose because the last 1 remains alone. But if you begin by the first (to the right) and after the third (to the right), you win. Note that there exist multiple solutions. (you can also move the blocks n°4 to the left and n°2 to the left).
So here Output = 2;