Day 44 — Mock: 3 tree problems, 60 minutes

Mock day · trees · strict timer

Tonight's goal: solve three tree problems in one 60-minute mock while talking aloud before and during every attempt.

Tonight's protocol

Use the mock-day process: speak first, code second, compare after the clock ends.

  1. Before the timer, 4 minutes max: answer the warm-up MCQs below. At minute 5, you must be solving.
  2. 0:00-0:20: solve Problem 1. Before typing, say the pattern name, brute force, better approach, and time/space complexity.
  3. 0:20-0:40: solve Problem 2. Keep narrating base cases, return values, and why each line belongs.
  4. 0:40-1:00: solve Problem 3. Do not pause the clock, and do not open solution text during the timer.
  5. If stuck inside a 20-minute slot: at minute 12, restate the invariant; at minute 17, read only the pattern name from the menu and try again.
  6. After 1:00: stop coding. Compare, then encode one reasoning-gap note for each miss.

The problem menu

TimeProblemPattern nameSay aloud
0:00-0:20 Binary Tree Level Order Traversal BFS levels (queue snapshot) The queue holds discovered nodes; len(q) freezes one level.
0:20-0:40 Diameter of Binary Tree Piggyback on height Each DFS returns height plus the best diameter seen below.
0:40-1:00 Serialize and Deserialize Binary Tree Preorder with explicit null markers The # tokens preserve missing children, so the shape is not guessed.

Warm-up MCQs

1. Which invariant separates BFS levels?

2. Which line matches inorder traversal?

3. Which choice misses diameter piggybacking?

4. Why are null markers required?

5. Which fact splits construction ranges?

6. When can Path Sum return true?

Self-check gate

Pass tonight only if

If you fail: add every failed or silent problem to the next revision list. Write WA: missed invariant - queue snapshot, WA: missed invariant - height plus answer, or WA: missed invariant - null markers, then re-solve from a blank file.