Daily Temperatures (LC #739) asks: for each day, how many days until a warmer temperature? Use a monotonic decreasing stack storing indices. For each temperature, while the stack is not empty and current is warmer than the stack top, pop and record the difference in indices. Push current index. This runs in time because each element is pushed and popped at most once. Space is for the stack. The monotonic stack pattern solves all "next greater/smaller element" problems efficiently.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/meta-interview-prep/stacks-queues/daily-temperatures
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████████████████████████████████████████████████████████████████████████