AlgoViz

Design a Top K / Trending Topics System

hard 45 min

Count billions of mentions a day and show the ten topics that are rising right now, in each country and city.

Mock interview

Answer against the clock, then score yourself.

0:00 of 45:00

Design a trending topics system for a social network. You have 45 minutes. Start the clock, answer each step out loud, then score yourself.

Step 1 of 7 · 5 min

Scope

Interviewer

Design trending topics. What do you want to know?

Cheat sheet (open after you finish)

Interview cheat sheet

  • 4 billion events a day, 46,300 a second, 139,000 at peak, three places each.
  • Account stage: repeats, trust, ten-second sums. Topic stage: buckets and score.
  • Union of top K per counter is enough when each topic has one counter.
  • Sketch error is at most eN/w. 10,000 columns are far too few for the whole hour.
  • Gate at 20: 200 GB becomes 2 GB.
  • Surprise score against the same hour on seven days.
  • 600 lists, 3 MB, 30 s at the edge, 58 s at worst.