Magicsheet logo

Most Popular Video Creator

Medium
50%
Updated 8/1/2025

Most Popular Video Creator

What is this problem about?

The Most Popular Video Creator problem gives you lists of creators, video IDs, and view counts. Find the creator(s) with the highest total views. Among their videos, also identify the most-viewed video (or the lexicographically smallest video ID in case of ties). Return both. This Most Popular Video Creator coding problem combines grouping, aggregation, and tiebreaking in one pass.

Why is this asked in interviews?

TikTok asks this to test multi-dimensional aggregation: first sum views per creator, then find the best video per creator, all while handling tiebreaking correctly. The array, hash table, sorting, heap, and string interview pattern is exercised. The problem mirrors real content ranking systems directly relevant to TikTok's business.

Algorithmic pattern used

Two hash maps. Map 1: totalViews[creator] = sum of all views for that creator. Map 2: bestVideo[creator] = the video with max views (or lexicographically smallest on ties). Traverse all entries once to build both maps. Then find the max value in totalViews. Return all creators with that max value, paired with their best video.

Example explanation

Creators: ["Alice","Bob","Alice","Bob"], videos: ["A1","B1","A2","B2"], views: [5,3,10,8].

  • totalViews: {Alice:15, Bob:11}.
  • bestVideo: Alice's best = "A2" (10 views > 5). Bob's best = "B2" (8 views > 3).
  • Max total views = 15 → only Alice. Return: [["Alice", "A2"]].

Common mistakes candidates make

  • Not handling lexicographic tiebreaking for best video.
  • Computing max total views separately from building the map (can be done in one pass).
  • Returning creator names without the best video ID.
  • Forgetting that multiple creators can tie for most popular.

Interview preparation tip

Multi-dimensional aggregation problems require clearly separating the aggregation phase (build maps) from the result extraction phase (find max, collect results). Avoid mixing these phases in a single messy loop. After building your maps, the result extraction is simple max-finding with tie handling. Practice similar problems in Python using defaultdict with custom tiebreaking logic — this is a common pattern in data analytics and ranking interview questions.

Similar Questions