#K1331. Daily Temperatures
Daily Temperatures
Daily Temperatures
You are given an array of integers representing the daily temperatures during the winter season. Your task is to determine, for each day, the number of days you must wait until a warmer temperature occurs. If there is no future day that is warmer, output 0 for that day. Formally, for an array of temperatures (T), for each index (i) you need to find the smallest index (j) (with (j > i)) such that (T[j] > T[i]); if such an index does not exist, the answer for (i) is 0.
inputFormat
The input is read from standard input (stdin). The first line contains a single integer (n), representing the number of days. The second line contains (n) space-separated integers, where each integer represents the temperature of a day.
outputFormat
Output a single line to standard output (stdout) containing (n) space-separated integers. The (i)th integer is the number of days you must wait after day (i) until a warmer temperature occurs. If there is no such day, output 0.## sample
8
73 74 75 71 69 72 76 73
1 1 4 2 1 1 0 0
</p>