Daily Temperatures

Medium
ArrayStackMonotonic StackAmazonGoogle
Given daily temperatures, for each day print the number of days you must wait until a warmer temperature. If there is no future day that is warmer, print 0 for that day. Input format: - First line: n - Second line: n integers Print n integers on one line.

Constraints

1 <= n <= 10^5
1 <= temperatures[i] <= 10^9

Sample tests

Sample 1

Sample 2

Sign in to submit