#K93717. Find Maximum Traffic Interval
Find Maximum Traffic Interval
Find Maximum Traffic Interval
You are given a number of test cases. For each test case, you are given an integer \(N\) representing the number of recorded time intervals, and then \(N\) integers representing the number of vehicles counted during each time interval. Your task is to identify the interval with the maximum vehicle count and report its 1-based index.
If there are multiple intervals with the same maximum count, choose the one with the smallest index.
For example, if the input is \(N = 5\) with counts \( [3, 7, 2, 9, 4] \), the answer is 4 because 9 is the maximum value and appears at index 4.
Formally, if the array of counts is \(a_1, a_2, \dots, a_N\), find the smallest index \(i\) such that \(a_i = \max\{a_1, a_2, \dots, a_N\}\).
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains a single integer \(T\) representing the number of test cases.
- For each test case:
- The first line contains a single integer \(N\) indicating the number of time intervals.
- The second line contains \(N\) space-separated integers representing the vehicle counts for each interval.
outputFormat
For each test case, output a single line containing one integer which is the 1-based index of the interval with the highest vehicle count. The outputs for different test cases should be printed on separate lines.
## sample5
5
3 7 2 9 4
4
10 10 10 5
3
5 5 5
1
10
10
1 4 6 4 7 3 5 9 6 2
4
1
1
1
8
</p>