Loading...
Loading...
Loading...
Hourly visitor counts rise strictly to one highest hour and then fall strictly. Either part can be empty. Print the position (counting from 0) of the highest hour.
Example
Input
6 2 6 9 12 8 3
Output
3
Try the problem first. Open one hint at a time.
Compare the middle count with the next one. If the next is larger, the top is to the right.
Otherwise the middle could be the top, so keep it with hi = mid.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor