FreeCareerPath
Build the PrimitiveMedium

Daily Temperatures

Write `daily_temperatures(temps)` returning, for each day, how many days you wait for a warmer one. Use `0` when no warmer day follows. daily_temperatures([73,74,75,71,69,72,76,73]) -> [1,1,4,2,1,1,0,0] "The next thing to the right that is bigger" is always a monotonic stack. Hold indices whose temperatures decrease; when a warmer day arrives, everything it beats pops off and gets its answer. Store indices, not temperatures — the answer is a distance.

What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.

Log in to start this session

Timed sessions and your results for "Daily Temperatures" are saved to your account — logging in takes a few seconds.

Daily Temperatures — FreeCareerPath