#K7666. Maximum Run Lengths

    ID: 34692 Type: Default 1000ms 256MiB

Maximum Run Lengths

Maximum Run Lengths

This problem requires you to find the maximum run length in an array for each test case. A run is defined as a consecutive segment of the same number. Formally, for an array \(A\) of length \(n\), the maximum run length is given by

[ \max_{1 \leq i \leq n} ; \text{(length of the consecutive block starting at } i\text{)} ]

You are given \(T\) test cases. For each test case, you will first receive an integer \(n\) which denotes the number of elements in the array, followed by \(n\) integers. Your task is to compute and output the maximum length of any run in the array.

Input and Output

The input is provided through standard input and the output should be printed to standard output.

inputFormat

The first line of input contains a single integer \(T\) representing the number of test cases.

For each test case, the input consists of two lines:

  • The first line contains an integer \(n\), the size of the array.
  • The second line contains \(n\) space-separated integers representing the elements of the array.

Example:

2
6
1 1 2 2 2 3
5
4 4 4 4 4

outputFormat

For each test case, output a single line containing one integer --- the maximum run length found in the array.

Example:

3
5
## sample
1
6
1 1 2 2 2 3
3

</p>