InterviewLegend

Design Ad-Click Top-K

Sometimes asked
Alex Chen34 min readUpdated 557 real interview reports

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.

The Google angle
Two things sharpen this prompt at Google. Your interviewer may sit close to the real revenue path, and people who do are allergic to a casual "exactly-once"; every correctness claim gets probed for its mechanism. The second lever is splitting the requirement. Advertiser dashboards can run a minute behind on fast estimates; invoices have to be exact and auditable. Say that split before anyone asks for it and the whole design reframes around it, judgment instead of pipeline trivia.
What's inside
  • 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

Had your Google interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Google interview guide

Know what Google asks before you walk in.

34 coding · 7 system design · 47 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.