BuildMidFrontendAuto-graded
Fix debounce and throttle that mistime event bursts
Two similar-sounding timing behaviours must be held apart and implemented to the exact boundary, which rewards careful reading.Two utilities every engineer eventually reimplements, and subtly mistimes. Debounce waits until the caller stops firing for a quiet interval, then runs once with the latest input — a search box that does not hit the API on every keystroke. Throttle runs immediately and then suppresses further calls until the interval elapses — a scroll handler that does not run on every pixel. Implement both with the edges and the timer resets correct.30 min
python
You're done when
- A rapid burst of debounced calls collapses to a single invocation carrying the last input.
- The debounced call fires only after the quiet period has genuinely elapsed.
- A late call during the wait resets the timer rather than letting the original deadline stand.
- A second burst after the first has settled fires again.
- The throttled call runs immediately on the leading edge, once per interval.
- Further calls inside that interval are suppressed.
What it measures
Event-driven architectureControlling the rate at which a stream of events reaches expensive work, with the right edge semantics for each case.
PythonManaging timers and captured state across calls without leaking either.
Attention to timing detailDistinguishing leading from trailing edge and knowing when a timer resets — the exact points where naive versions go wrong.
Your environment
Terminal + editorA full shell in the browser
Claude CodePre-authenticated, no key setup
Isolated microVMYours alone, wiped afterwards
Start this lab
30 min
Start labYou'll sign in to Anthropos to start. The lab opens in a private cloud workspace with Claude Code ready to use.AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo