Back to course home
0% completed
Solution: Daily Temperatures
Problem Statement
Given an array of integers temperatures
representing daily temperatures, your task is to calculate how many days you have to wait until a warmer temperature. If there is no future day for which this is possible, put 0 instead.
Examples
-
- Input:
temperatures = [70, 73, 75, 71, 69, 72, 76, 73]
- Output:
[1, 1, 4, 2, 1, 1, 0, 0]
- Explanation: The first day's temperature is 70 and the next day's temperature is 73 which is warmer. So for the first day, you only have to wait for 1 day to get a warmer temperature
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible