#C6810. Find the Cheapest Day for Taco Ingredient
Find the Cheapest Day for Taco Ingredient
Find the Cheapest Day for Taco Ingredient
You are given an integer ( n ) representing the number of days, and a list of ( n ) integers where each integer denotes the price of a taco ingredient on that day. Your task is to determine the first day (using 1-based indexing) when the price is the lowest. In other words, if there are multiple days with the same minimum price, return the earliest day.
For example, given ( n = 5 ) and prices ( [10, 20, 5, 5, 30] ), the answer is day 3 because the minimum price is 5 which occurs first at day 3.
inputFormat
The first line of input contains a single integer ( n ), representing the number of days. The second line contains ( n ) space-separated integers representing the prices for each day.
outputFormat
Output a single integer which is the 1-indexed day on which the price is the lowest.## sample
5
10 20 5 5 30
3