Algorithm · C3.ai · Medium
You are given a sequence of daily temperatures. For every day, determine how long a run of consecutive days, ending on that day and including it, has that day's temperature as the highest value. Return these counts as a list, one entry per day. Example 1: Explanation: On the day with temperature 60, the stretch reaching back through 30 and 10 is three days long and 60 is the highest in it; for 40, the stretch covers 20, 10 and 40 itself, giving 3; the final day at 90 tops…