Marking the Peak on a Line Chart
A traffic report charts hourly counts as a line and puts one bold dot on the busiest hour, because a reader looking at a line will otherwise pick out whichever bump is nearest the middle. The report also states which reading that dot sits on, counting the readings from 0 — so the first reading is reading 0, the second is reading 1, and so on. If the busiest count occurs more than once, the report points at the earliest of them.
Task: Print the position of the highest reading.
Input
The first line holds an integer n, the number of hourly readings. Each of the next n lines holds one reading, in hour order.
Output
One line holding the position of the highest reading, counting from 0, as a plain integer.
Example:
Input:
4
10
50
30
20
Output:
1
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in