License to Launch
InterviewTime limit1sMemory limit512 MB
Find the earliest index of the minimum value in an array of n space-junk counts and print the zero-based day.
- Level
Easy2 of 10
- Topics
- Array, Implementation, Brute force
- Solved
- No attempts yet
Problem
Birk has built a new rocket and just received a license from the Bluesky Global Order (BGO) to launch on any day within the next days. He worries that the rocket might hit space junk on the way up, so he has modeled how many pieces of space junk will be present on each of the next days. He will launch on the day with the least space junk, and if several days have the same amount, he wants to launch as early as possible.
Help Birk determine how many days he must wait before launching.
Input
The first line contains a single integer (), the number of days the launch license is valid.
The second line contains integers between and . The -th integer is the amount of space junk on the -th day. The first day is day .
Output
Output a single integer: the number of days Birk must wait before he launches his rocket.