Tonight's goal: pick 2–3 heap problems, explain the heap choice aloud before coding, and prove you can answer the heap gate without outside prep.
Tonight's protocol
Use the mock / mixed day process: strict timer first, approach out loud, code second, compare after.
0:00–0:04: answer the warm-up MCQs below. Do not open a solution.
0:04–0:05: choose the timed set from the menu: two normal problems = 45 minutes, three normal problems = 60 minutes, or Median + one normal problem = 55 minutes. Median counts double.
Before each problem: spend 90 seconds saying the pattern name, brute force, better approach, time, space, and: min-heap or max-heap, and what lives in it?
During the timer: give normal problems 18–20 minutes each. Give Median up to 35 minutes. If stuck at 25 minutes, read only the pattern name, then try ten more minutes.
Final 5 minutes: compare only after the timer ends. Write one Notion note per miss: invariant, bug, or gate answer to revisit.
The problem menu
Pick only from this menu. Explain aloud before typing.
1. Kth Largest asks for the kth largest value, not a full order. Which invariant applies?
Lesson 37's invariant: "A heap hands you the best remaining element in O(log n) per update; keep a min-heap of size k to hold the k largest."
2. A top-k heap reaches size k + 1. What must happen next?
Lesson 37's invariant: "A heap hands you the best remaining element in O(log n) per update; keep a min-heap of size k to hold the k largest."
3. What belongs in the heap for Merge k Sorted Lists?
Lesson 38's invariant: "The heap holds one head per list; pop the smallest, push its successor, repeat until every list is drained."
4. In Median Finder, high has two more items than low. What failed?
Lesson 39's invariant: "A max-heap of the lower half and a min-heap of the upper half, kept balanced, put the median at the tops."
5. A remaining task goes straight back into the heap immediately. Which rule breaks?
Lesson 40's invariant: "Always run the most frequent available task; a cooldown queue holds tasks until they are legal again."
6. A problem asks for median after every stream insert. Which pattern name should you say?
Lesson 39's invariant: "A max-heap of the lower half and a min-heap of the upper half, kept balanced, put the median at the tops."
Self-check gate
Pass bar
Before comparing, you can answer this for all five menu problems: min-heap or max-heap, and what lives in it? For your chosen problems, you also said the approach and complexity before writing code.
Failure path: if any heap direction or heap contents answer is unclear, add that problem to the next revision. Write one root-cause line such as WA: heap direction, WA: heap contents, WA: rebalance, or WA: cooldown. Re-solve it later from a blank file with no hints. If Median fails, add it as two revision slots because it counts double.