Design an ad click aggregator
Hard45 minFree, no account
A million events a second, money attached to the count, and events that arrive an hour late.
The question
Design the system that counts ad clicks and shows advertisers a dashboard with near-real-time numbers.
Advertisers are billed from these counts, so they have to be right.
Functional
- Record a click with its ad, campaign, timestamp and context.
- Dashboard showing clicks per campaign per minute, within about a minute.
- Accurate daily totals for billing.
- Arbitrary slicing by country, device and placement.
Non-functional
- 1M clicks/sec at peak.
- Dashboard freshness within ~1 minute.
- Billing totals must be exact and reproducible.
- Events can arrive minutes or hours late from mobile clients.
45:00Commit to an answer before you open the solution. Reading it first teaches you to recognise good answers, which is not the skill being tested.
Stuck?
0 of 3 hints takenThe worked solution
written by a person · not a gradeScore yourself
0 of 5 marked- Separated the fast path from the exact path over one immutable log25
- Aggregated on event time with watermarks and handled late data explicitly25
- Made counting idempotent and replay-safe rather than incrementing25
- Gave a workable answer for arbitrary slicing15
- Addressed clock skew or fraud using the raw events10
We run no AI here and nothing on this page grades you. The score is yours, and the useful number is the one you get on the same problem a month from now, cold.
kept in this browser only