← All mock interviewsHints used: 0
Daily Temperatures Mock Interview
- ✓Problem→
- 2Clarifying Questions→
- 3Constraints→
- 4Brute Force→
- 5Complexity Analysis→
- 6Pattern Recognition→
- 7Optimized Solution→
- 8Implementation→
- 9Testing→
- 10Follow-Up→
- 11Evaluation
Problem
Given an array temperatures where temperatures[i] is the temperature on day i, return an array answer where answer[i] is the number of days you have to wait after day i to get a strictly warmer temperature. If there is no future day with a warmer temperature, answer[i] should be 0.
Constraints
- 1 ≤ n ≤ 10^5
- 30 ≤ temperatures[i] ≤ 100
Example
in: temperatures = [73,74,75,71,69,72,76,73]
out: [1,1,4,2,1,1,0,0]
Clarify
Before choosing anything: what would you ask the interviewer? What assumptions are you making? (Duplicates? Empty input? Value ranges? What to return when there is no answer?)