Code Room
CodingMediumcod-g100
Subject StacksLevel Mid–Senior~25 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Given a list of daily temperatures (integers), return a list answer where answer[i] is the number of days you must wait after day i to get a warmer temperature. If no future day is warmer, answer[i] is 0. The input has 1 to 10^5 entries and temperatures are between 30 and 100 inclusive.

Implement
daily_temperatures(temps: list[int]) → list[int]
Examples
in[[73,74,75,71,69,72,76,73]]out[1,1,4,2,1,1,0,0]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.