Daily Temperatures
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given an array temperatures where temperatures[i] is the recorded temperature on day i.
For every day, determine how many days you would have to wait until a day with a strictly warmer temperature arrives. Return an array answer of the same length, where answer[i] is the number of days you must wait after day i to reach a warmer day.
If no future day is warmer than day i, set answer[i] to 0.
Examples
Constraints
- 1 <= temperatures.length <= 10^5
- 30 <= temperatures[i] <= 100
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.