Design Ad-Click Top-K
This prompt arrives under a few names: "count ad clicks," "ad-click aggregation," "top-K most-clicked ads." They are all the same system. Ads earn the large majority of Google's revenue. A click is a small financial event, worth anywhere from cents to many dollars, so the system that counts them is effectively a cash register. That stake is what makes the question interesting. The YouTube and Maps designs earlier in this guide got to relax correctness. A view count running a minute behind harms nobody, and neither does a new café that takes a minute to appear in search. Here the tolerances flip. Overcounting bills an advertiser for clicks that never happened, and undercounting burns Google's own revenue.
Anchor on the numbers. Call it a billion billable clicks a day, which averages about 12,000 a second and spikes several-fold during shopping season. Each event is tiny, an ad id with a timestamp and some context, around 100 bytes. So the firehose is heavy in events but light in bytes. Unlike YouTube, the writes are the product. Reads are a comparative trickle: advertiser dashboards, top-K queries, and the nightly billing run.
- 1 diagram
- 5 sections
- about 34 min
Premium lessonGoogle interview guide
These took digging.
What candidates walked out with, from 20,000+ reports, forum threads behind logins and write-ups in Chinese. Then solved step by step.
100 companies. Checked every month.
Unlock all 100 companies$49 a year · less than $1 a week · Cancel anytime
Google interview guideKnow what Google asks before you walk in.
34 coding · 7 system design · 47 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.