Daily Temperatures
Read the lesson → understand the pattern → then code. Tutor works offline (built-in teacher); optional Cursor/Gemini keys upgrade chat quality.
Topic refresher: Stack — Last In, First Out
LIFO for matching, undo, and next-greater patterns.
stack<char> st;
for (char c : s) {
if (/* open */) st.push(c);
else {
if (st.empty() || st.top() != need) return false;
st.pop();
}
}
return st.empty();MediumStack & Monotonic StackLeetCode #739
Daily Temperatures
Next warmer day distance. Monotonic decreasing stack of indices.
Examples
Example 1
Input
8 73 74 75 71 69 72 76 73
Output
1 1 4 2 1 1 0 0
Stuck? Take a nudge
C++17Autosaves