Pattern
Stack
Use a stack when the most recent unfinished thing must be dealt with first, as in matching brackets, undoing steps or finding the next larger item. Keep only what is still waiting. Each item is pushed and popped once, so the cost is usually O(n).
1. Valid Parenthesesstring · stack · matchingEasy2. Min Stackstack · design · data structureMed.3. Evaluate Reverse Polish Notationarray · stack · mathMed.4. Generate Parenthesesbacktracking · recursion · string · stackMed.5. Daily Temperaturesarray · stack · monotonic stackMed.6. Car Fleetarray · stack · sortingMed.7. Largest Rectangle In Histogramarray · stack · monotonic stackHard