#K83337. Taco Tiles Repainting

    ID: 36175 Type: Default 1000ms 256MiB

Taco Tiles Repainting

Taco Tiles Repainting

You are given a row of tiles where each tile is painted with a certain color. Your task is to determine the minimum number of repaint operations required so that no two adjacent tiles share the same color. In one repaint operation, you can change the color of a single tile arbitrarily (to any color different from its immediate left neighbor after repainting) to ensure that the condition is met.

Input: The first line contains an integer T representing the number of test cases. Each test case consists of two lines. The first line of a test case contains an integer N, the number of tiles. The second line contains N space-separated integers representing the initial colors of the tiles.

Output: For each test case, output the minimum number of repaint operations required, each on a new line.

inputFormat

The input begins with an integer T, the number of test cases. For each test case:

  • The first line contains an integer N, representing the number of tiles.
  • The second line contains N space-separated integers representing the colors of the tiles.

outputFormat

For each test case, output a single integer on a new line denoting the minimum number of repaint operations required so that no two adjacent tiles have the same color.## sample

1
4
1 2 2 3
1

</p>