Before 73 arrives, which indices are unresolved? Why keep both equal 69s?
1 / 10
Derive the unresolved order
Future scanning from every day repeats work.
Instead, each arrival resolves the most recent colder questions.
If it cannot resolve the newest question, why can it stop?
2 / 10
Valid Parentheses — predict before coding
The stack stores unmatched openings in nesting order. Counts alone cannot distinguish properly nested brackets from crossing pairs.
Decision: Why is "([)]" invalid despite having one opening and closing of each type?
3 / 10
Simplify Path — predict before coding
A lexical path stack models directory components. Dot and dot-dot have special meaning only as whole components; names such as ... are ordinary names.
Decision: What does "/a/.../../b//./" simplify to?
4 / 10
Min Stack — predict before coding
The minimum is part of each prefix state. Recording the prefix minimum alongside every pushed value makes popping a duplicate minimum unambiguous.
Decision: After Push(2), Push(1), Push(1), Pop(), what must GetMin return?
5 / 10
Evaluate Reverse Polish Notation — predict before coding
The stack contains completed subexpression values whose parent operators have not yet arrived. Operand order is carried by position, not by operator commutativity.
Decision: What does ["7","-3","/"] evaluate to, and why is the result not -3?
6 / 10
Daily Temperatures — predict before coding
The stack holds unresolved days, not temperatures alone. A new warmer day resolves exactly the colder unresolved suffix, with the first such day being the nearest answer.
Decision: For [70,70,71], what are the waiting times?
7 / 10
Largest Rectangle in Histogram — predict before coding
Popping a height means its first strictly lower bar on the right has arrived. The stack reveals how far that height can extend left without crossing a lower barrier.
Decision: For heights [2,2,2], what area must eventually be considered even though equal heights are not popped immediately?
8 / 10
Basic Calculator — predict before coding
Parentheses suspend an outer accumulator and its pending sign. When the inner expression finishes, it becomes one signed operand of that suspended context.
Decision: What is the value of "1-(2-(3+4))", and which sign applies to the whole inner expression?
9 / 10
Reconstruct and transfer
Explain strict versus non-strict comparisons for equal temperatures and histogram bars.
Derive rectangle width.
Account for every push and pop once.
10 / 10
←/→ or click edges to navigate · ? help · N notes · F fullscreen