Most Popular Video Creator - Problem

🎥 Most Popular Video Creator

You're working as a data analyst for a video streaming platform similar to YouTube. Your task is to identify the most popular content creators based on their total view counts across all their videos.

Given three arrays:

  • creators[i] - the name of the creator who made the i-th video
  • ids[i] - the unique identifier of the i-th video
  • views[i] - the number of views the i-th video has received

Your Goal: Find the creator(s) with the highest total popularity (sum of all their video views) and identify their most popular video.

Special Rules:

  • If multiple creators tie for highest popularity, include all of them
  • If a creator has multiple videos with the same highest view count, choose the one with the lexicographically smallest video ID
  • Different videos can share the same ID (they're still considered separate videos)

Return a 2D array where each row contains [creator_name, most_popular_video_id] for each top creator.

Input & Output

example_1.py — Basic Case
$ Input: creators = ["alice","bob","alice","charlie"] ids = ["one","two","three","four"] views = [5,10,5,4]
Output: [["alice","one"]]
💡 Note: Alice has total views of 5+5=10, Bob has 10 views, Charlie has 4 views. Alice has the highest total. Among Alice's videos, both have 5 views, but 'one' is lexicographically smaller than 'three'.
example_2.py — Multiple Winners
$ Input: creators = ["alice","alice","alice"] ids = ["a","b","c"] views = [1,2,2]
Output: [["alice","b"]]
💡 Note: Alice is the only creator with total views of 5. Among her videos with max views (2), 'b' is lexicographically smaller than 'c'.
example_3.py — Tie Breaker
$ Input: creators = ["alice","bob","charlie"] ids = ["video1","video2","video3"] views = [10,10,10]
Output: [["alice","video1"],["bob","video2"],["charlie","video3"]]
💡 Note: All creators have equal popularity (10 views each), so all are included in the result with their respective video IDs.

Constraints

  • n == creators.length == ids.length == views.length
  • 1 ≤ n ≤ 105
  • 1 ≤ creators[i].length, ids[i].length ≤ 5
  • creators[i] and ids[i] consist of lowercase English letters only
  • 0 ≤ views[i] ≤ 105

Visualization

Tap to expand
📊 Video Platform Analytics Dashboard📈 Creator Leaderboard🥇 Alice: 1,500 total views🥈 Bob: 1,200 total views🥉 Charlie: 800 total views⚡ Real-time updates as videos are processed🎬 Top VideosAlice's best: "tutorial_1" (900 views)Bob's best: "vlog_5" (1200 views)Charlie's best: "review_3" (800 views)📝 Lexicographic ordering for ties🏆 Final ResultMost Popular Creator: AliceBest Video: "tutorial_1"
Understanding the Visualization
1
Initialize Tracking
Set up data structures to monitor creator performance metrics
2
Process Video Stream
As each video data arrives, update the creator's total views and check if it's their new best video
3
Update Leaderboard
Track the highest total popularity and identify leading creators
4
Generate Report
Compile final results showing top creators and their most successful videos
Key Takeaway
🎯 Key Insight: By processing the video stream once and maintaining running statistics, we can efficiently identify the most successful creators and their top-performing content in linear time.
Asked in
Google 45 Amazon 38 Meta 32 Netflix 28
95.0K Views
Medium Frequency
~15 min Avg. Time
2.8K Likes
Ln 1, Col 1
Smart Actions
💡 Explanation
AI Ready
💡 Suggestion Tab to accept Esc to dismiss
// Output will appear here after running code
Code Editor Closed
Click the red button to reopen