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