🧠 Before you code — what pattern fits?
Given an array temperatures, return an array answer where answer[i] is the number of days you have to wait after day i to get a warmer temperature (0 if none).
[73,74,75,71,69,72,76,73] → [1,1,4,2,1,1,0,0]
🎬 Video explanation · NeetCode
Your solution runs against 3 unit tests, including edge and large-value cases.
Loading...
Test console · 3 unit tests
Submit your code to run it against all 3 unit tests. Results appear here.
JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.