Daily Temperatures
Given temperatures, return an array answer where answer[i] is the number of days you'd wait after day i for a warmer temperature. If no warmer day exists, answer[i] is 0.
The O(n) answer is a monotonic decreasing stack of indices: when a warmer day arrives, pop every colder day off the stack and record the gap.
dailyTemperatures([73, 74, 75, 71, 69, 72, 76, 73]);
// [1, 1, 4, 2, 1, 1, 0, 0]