#K85302. Longest Uniform Subarray

    ID: 36611 Type: Default 1000ms 256MiB

Longest Uniform Subarray

Longest Uniform Subarray

Given an array of integers, your task is to determine the length of the longest contiguous subarray in which all elements are identical. In other words, you need to find the maximum number of consecutive equal elements.

Formally, given an array \(a_1, a_2, \dots, a_N\), find the maximum \(k\) such that there exists an index \(i\) for which \(a_i = a_{i+1} = \dots = a_{i+k-1}\). If the array is empty (i.e., \(N=0\)), the answer is 0.

inputFormat

The first line of input contains an integer \(N\) representing the number of elements in the array. If \(N > 0\), the second line contains \(N\) space-separated integers representing the elements of the array.

outputFormat

Output a single integer — the length of the longest contiguous subarray with all elements equal.

## sample
9
1 1 0 1 1 1 0 0 0
3

</p>