Day 06 — Revision: Arrays week

Revision day · arrays patterns · blank-file recall

Tonight's goal: prove the array patterns can come back from memory under a timer, then solve one fresh prefix-sums problem.

Tonight's protocol

Use the revision-day rule: blank file, no hints, first or second run only.

  1. 0:00–0:03: scan the menu below and pick your 3 weakest. If nothing stands out, choose one hashing, one running-scan, and one prefix-sums problem.
  2. 0:03–0:05: open a blank file. For the first problem, say the pattern name, brute force idea, and target complexity out loud.
  3. 0:05–0:17: re-solve weak problem 1. No notes, no stored code, no hints. If it fails after two runs, stop and log WA: <root cause>.
  4. 0:17–0:29: re-solve weak problem 2 with the same two-run gate.
  5. 0:29–0:41: re-solve weak problem 3 with the same two-run gate.
  6. 0:41–0:56: solve fresh: Range Sum Query - Immutable. Predict the prefix array shape before coding.
  7. 0:56–1:00: encode one note per miss: invariant, bug, edge case, or misread condition. Failed items stay in the next revision queue.

The problem menu

Pick your 3 weakest from this menu, re-solve each from a blank file, and use no hints.

ProblemPattern name
Two SumHashing / seen question
Best Time to Buy and Sell StockGreedy min-tracking
Contains DuplicateHashing / seen question
Maximum SubarrayKadane's algorithm
Product of Array Except SelfPrefix × suffix products
Move ZeroesTwo pointers, same direction
Merge Sorted ArrayTwo pointers, converging
Majority ElementBoyer-Moore majority vote
Missing NumberXOR cancellation
Find Pivot IndexPrefix sums
Range Sum Query - ImmutablePrefix sums, fresh solve

Warm-up MCQs

1. Which invariant fits a repeated “have I seen X?” question?

2. When scanning stock prices, which carried fact matters?

3. Maximum Subarray versus Product Except Self: which sentence resets the local candidate?

4. Which invariant fits Merge Sorted Array?

5. Which cancellation invariant fits Missing Number rather than Majority Element?

6. Range Sum Query asks many sums on one fixed array. Which invariant applies?

Self-check gate

Pass tonight if all three are true

If you miss the gate, do not tick Revision Done. Add the failed problem to the next revision list, compare only after the attempt, and write the invariant that would have prevented the miss.