상위 150개 인터뷰쉬움

일일 기온

'일일 온도' 문제에 대한 자세한 가이드 및 Python 구현입니다.

문제 설명

쉬움

temperatures 정수 배열이 일일 기온을 나타내는 경우 answer[i]는 더 따뜻한 기온을 얻기 위해 i일 이후 기다려야 하는 일수인 answer 배열을 반환합니다. 이것이 가능한 미래의 날이 없다면 대신 answer[i] == 0를 유지하세요.

dailyTemperatures(temperatures: List[int]) -> List[int] 함수를 작성하세요.

제약
  • 1 <= len(temperatures) <= 10^5
  • 30 <= temperatures[i] <= 100

Example 1
Input
temperatures = [73, 74, 75, 71, 69, 72, 76, 73]
Output
[1, 1, 4, 2, 1, 1, 0, 0]
Explanation

Day 0 (73): next warmer is day 1 (74), wait 1 day. Day 2 (75): next warmer is day 6 (76), wait 4 days. Days 6 and 7 have no warmer future day.

Example 2
Input
temperatures = [30, 40, 50, 60]
Output
[1, 1, 1, 0]
Explanation

Each day except the last has a warmer day immediately after.

Example 3
Input
temperatures = [30, 60, 90]
Output
[1, 1, 0]
Explanation

Temperatures are strictly increasing except the last day.

Need a Hint?
세트나 힙과 같은 스택별 데이터 구조를 사용해 보세요.
Edge Cases to Watch
  • 빈 입력 구조
  • 단일 요소 입력
  • 큰 수치 범위

해결할 준비가 되셨나요?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

편집기에서 열기
Found this breakdown helpful?

PyRun is built and maintained by an independent solo developer. If this helped your interview prep, consider buying a coffee!

Buy me a coffee

권장 Python 리소스

관련 대화형 튜토리얼, 치트 시트, 코드 비교를 통해 지식을 확장하세요.