#C1729. Longest Equal Subarray

    ID: 44966 Type: Default 1000ms 256MiB

Longest Equal Subarray

Longest Equal Subarray

Given an array of integers, your task is to determine the length of the longest contiguous subarray in which all elements are equal.

For each test case, the input starts with an integer N representing the number of elements in the array, followed by a line containing N space-separated integers.

The answer for each test case is the maximum length L such that there exists an index i with

\[ L = \max_{\text{contiguous segment}} \{ k : a_i = a_{i+1} = \cdots = a_{i+k-1} \} \]

Print the result on a new line for each test case.

inputFormat

The first line contains an integer T denoting the number of test cases.

For each test case, the first line contains an integer N indicating the number of elements. The second line contains N space-separated integers.

outputFormat

For each test case, output a single line with an integer representing the length of the longest contiguous subarray with equal elements.

## sample
3
5
1 1 2 2 2
4
2 2 2 2
1
10
3

4 1

</p>