Day 14 — Mock: 3 problems, 45 minutes
mock day · strings · sliding window · Python
Tonight's goal: run one short interview-style set, talk aloud before every solution, and state time and space complexity before writing code.
Tonight's protocol
Use the mock-day protocol, adapted to one strict 45-minute block:
- 0:00–3:00: answer the warm-up MCQs below. If you miss one, read only its invariant quote and move on.
- 3:00–4:00: open one blank file and the three LeetCode tabs. Do not open notes, saved code, hints, or solution text.
- 4:00–16:00: solve Problem 1. Before typing, say the pattern, brute force, better approach, time, and space out loud.
- 16:00–31:00: solve Problem 2. If stuck after eight minutes, reread only the pattern name in the menu and restart your explanation.
- 31:00–45:00: solve Problem 3. Same rule: explain aloud first, complexity before code, no solution text during the timer.
- 45:00: stop coding. Compare after the timer, then write one note per miss: invariant, bug, or edge case.
The problem menu
The first four minutes are for warm-up and setup. The remaining forty-one minutes are the timed mock.
Warm-up MCQs
1. Which invariant identifies anagrams?
Invariant: "Two strings are anagrams iff their letter-count histograms match; the histogram is also a perfect grouping key."
2. Which invariant handles cleaned palindrome validation?
Invariant: "Walk one pointer in from each end, skipping what doesn't count, comparing as you go."
3. A solution records best before removing a duplicate. What broke?
Invariant: "Grow the window on the right greedily; shrink from the left only until it is valid again. Here valid = no repeated character."
4. What validity rule belongs to replacement budget?
Invariant: "Same window, new validity rule: windowSize minus the most frequent char count must stay within k."
5. Which action order finds the smallest covering substring?
Invariant: "Expand until the window covers every needed character count, then shrink to find the smallest such window. (Hard — go slow.)"
6. Which invariant starts palindrome search?
Invariant: "Every palindrome has a center; there are 2n-1 centers, so expand outward from each."
Self-check gate
Pass tonight if all three are true
- You attempted all three problems inside the 45-minute block.
- Before each code attempt, you said the pattern, brute force, better approach, and time/space complexity aloud.
- At least two problems passed, and every miss has one written root cause.
Failure path: add every failed problem to the next revision list with WA: <root cause>. Re-solve it later from a blank file with no hints.