#K40222. Maximum Billboard Size
Maximum Billboard Size
Maximum Billboard Size
You are given the number of buildings in a row and the heights of these buildings. A billboard can be installed on a series of consecutive buildings if and only if all these buildings have the same height. Your task is to determine the maximum number of consecutive buildings where a billboard can be installed.
More formally, given an integer (N) and a list of integers representing building heights, find the maximum length of a contiguous segment in which all the buildings have identical heights.
inputFormat
The first line contains a single integer (N), the number of buildings. The second line contains (N) space-separated integers representing the heights of the buildings.
outputFormat
Output a single integer representing the maximum number of consecutive buildings with the same height.## sample
7
1 2 2 2 1 1 1
3