Day 43 — Revision: Advanced trees

revision day · blank-file recall · advanced trees

Tonight's goal: pick your 3 weakest advanced-tree problems, re-solve each from a blank file with no hints, and prove the invariant still comes back under pressure.

Tonight's protocol

Use the revision-day protocol: recall first, code second, only the first or second run counts.

  1. 0:00–0:05 Warm up: answer the MCQs below without notes. Mark any invariant you miss.
  2. 0:05–0:08 Choose: pick your 3 weakest from the menu. Weakest means missed invariant, slowest recall, or least confidence.
  3. For each chosen problem, 25 minutes: spend 2 minutes saying the pattern name, invariant, brute force, and target complexity; spend 18 minutes coding in a blank file; spend 5 minutes running and making one fix.
  4. After each problem, 2 minutes: mark Pass only if it compiles and passes on run one or two. Otherwise write WA: <root cause>.
  5. Final 7 minutes: compare only failed or unclear items with the source lesson, then encode one correction sentence in your tracker.

The problem menu

Redo your 3 weakest. Blank file, no hints, no stored code.

ProblemPattern name
Lowest Common Ancestor Tree recursion: split under the current node
Binary Tree Right Side View BFS levels: queue-length snapshot, keep the last node
Serialize and Deserialize Binary Tree Preorder plus explicit null markers
Path Sum DFS paths: carry the remaining sum
Construct Binary Tree from Preorder and Inorder Preorder root plus inorder split with hashmap

Warm-up MCQs

1. Which invariant decides the LCA when targets split?

2. What keeps Right Side View level boundaries honest?

3. What makes serialized tree shape unambiguous?

4. When may Path Sum accept a path?

5. Which fact starts each reconstruction step?

Self-check gate

GateTonight's bar
PassAll 3 selected problems pass from a blank file on run one or two, and you state the matching invariant before coding.
FailAny selected problem needs hints, stored code, notes during the timer, or a third run before passing.

If a problem fails the gate, add that exact problem to the next revision queue. Write one cause: missed split, blurred level boundary, forgotten null marker, early Path Sum success, or wrong traversal range.