The Stock Market Dip
Welcome to UptoSkills Arena! Rohan is a novice stock trader. He bought shares of a company on various days. He wants to know the day he should have sold his shares to minimize his loss, meaning, the day with the lowest price. Given a list of daily stock prices, find the lowest price Rohan could have achieved. If there are multiple days with the same lowest price, choose the earliest day.
Input
The first line contains an integer N, the number of days. The second line contains N space-separated integers representing the stock prices for each day.
Output
A single integer representing the index (0-based) of the day with the lowest stock price.
Constraints
1 <= N <= 1000. Stock prices are integers between -10^9 and 10^9.
Example 1
5 10 5 12 8 5
1
The lowest price is 5, which occurs on day 1 and day 4. The earliest day is day 1 (0-based index).
Example 2
3 100 200 300
0
The lowest price is 100, occurring on day 0.
Hints
# Read the input from stdin and print the answer.
import sys
def main():
data = sys.stdin.read().split()
# your code here
main()
5 10 5 12 8 5
3 100 200 300