Loading...
Loading...
Loading...
For each day, count how many days you must wait for a warmer temperature. If there is no warmer day, print 0 for that day.
Example 1
Input
8 73 74 75 71 69 72 76 73
Output
1 1 4 2 1 1 0 0
Day 0 waits 1 day for 74.
Example 2
Input
4 30 40 50 60
Output
1 1 1 0
Try the problem first. Open one hint at a time.
The answer is a distance, so store indexes on the stack.
When day i is warmer than the day on top, the wait is i - top.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor