Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Daily Temperatures

Python data engineering interview problem. Difficulty: intermediate. Pattern: Stacks. About 14 minutes. Part of the Pro drill bank.

Days until a warmer temperature for each day. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

Implement daily_temperatures(temperatures: list) -> list.

Constraints

  • If no warmer day exists, store 0.
  • Return a list same length as input.

Examples

Input: daily_temperatures([73, 74, 75, 71, 69, 72, 76, 73]) Output: [1, 1, 4, 2, 1, 1, 0, 0] Next warmer offsets.

Topics: lakebench, python, monotonic stack, next greater.

More Python interview questions · All interview problems · Learn data engineering

intermediate

Daily Temperatures

Interview-style drill: Days until a warmer temperature for each day.

Implement `daily_temperatures(temperatures: list) -> list`. Example: `[73, 74, 75, 71, 69, 72, 76, 73]` → `[1, 1, 4, 2, 1, 1, 0, 0]`. Keep the harness.