LeetCode 739 Daily Temperatures - Problem Statement

The problem

Given an array of daily temperatures, return an array where answer[i] is the number of days until a warmer temperature. If no warmer day exists, put 0.

With [73, 74, 75, 71, 69, 72, 76, 73]:

  • Day 0 (73°): Day 1 is warmer. Wait 1 day.
  • Day 1 (74°): Day 2 is warmer. Wait 1 day.
  • Day 2 (75°): Day 6 is warmer. Wait 4 days.
  • Day 6 (76°): No warmer day. Answer: 0.

Result: [1, 1, 4, 2, 1, 1, 0, 0].

Constraints: 11 \le length 105\le 10^5. Temperatures 3030 to 100100.