2 min lesson
The 45-minute protocol
Rebuild the sequence in "The 45-minute protocol" from memory, ending with the check that proves the outcome.
Step 1 of 2
The 45-minute protocolRun it like the real screen
Interactive diagram. Step through it with the Next and Previous controls below, or Tab to a region to read its detail.
diagram: flow
Test is the gate: clearing your own cases before you talk complexity is what separates a pass from a stall.
Learn more
Full explanation
A thread-safe token bucket you can defend line by line, no AI
Concurrency rep: a thread-safe token bucket you can defend line by line, no AIts
type Bucket = { capacity: number; tokens: number; refillPerSec: number; last: number; // epoch ms of last refill }; function allow(b: Bucket, now: number, cost = 1): boolean { // Lazy refill: compute tokens earned since last check, cap at capacity. const elapsedSec = (now - b.last) / 1000; b.tokens = Math.min(b.capacity, b.tokens + elapsedSec * b.refillPerSec); b.last = now; if (b.tokens >= cost) { b.tokens -= cost; return true; } return false; // throttle: caller returns 429 + Retry-After }
Typing it isn't the point. The point is that you can answer: why lazy refill instead of a background timer, what breaks under concurrent callers, why tokens is a float and not an int. If you can't defend a line, you don't actually know it.