O27

Daily Temperatures (Next Greater Element)

Mid / Senior Engineer
Target Time: 25 - 35 Minutes
Type: ARRAY

Problem Statement & Objective

Given an array of integers temperatures representing daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the i-th day to get a warmer temperature.

Function Signature (Python)

daily_temperatures(temperatures: list[int]) -> list[int]

Input & Output Contract

Output Rule:Bekleme gün sayılarını içeren aynı uzunlukta tam sayı listesi.

System Constraints

1 <= sicakliklar.length <= 10^5
30 <= sicakliklar[i] <= 100

Example Execution Walkthrough

sicakliklar = [73, 74, 75, 71, 69, 72, 76, 73]
cevap: [1, 1, 4, 2, 1, 1, 0, 0]

Example Test Scenarios (3)

Example 1
Input:[[73,74,75,71,69,72,76,73]]
Expected Output:[1,1,4,2,1,1,0,0]
Example 2: Sürekli Artan
Input:[[30,40,50,60]]
Expected Output:[1,1,1,0]
Example 3: Hızlı Artış
Input:[[30,60,90]]
Expected Output:[1,1,0]
Loading Python Editor...
Input Parameters
[
  [
    73,
    74,
    75,
    71,
    69,
    72,
    76,
    73
  ]
]
Expected Output
[
  1,
  1,
  4,
  2,
  1,
  1,
  0,
  0
]