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.
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.
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.
Creators: ["Alice","Bob","Alice","Bob"], videos: ["A1","B1","A2","B2"], views: [5,3,10,8].
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.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Reward Top K Students | Medium | Solve | |
| Group Anagrams | Medium | Solve | |
| Alert Using Same Key-Card Three or More Times in a One Hour Period | Medium | Solve | |
| Before and After Puzzle | Medium | Solve | |
| Find And Replace in String | Medium | Solve |