Top K Most Streamed Disney+ Titles With Alphabetical Tie-Breaks
Last updated: November 29, 2026
Quick Overview
Given a list of play events where each event is a title name, return the k most played titles with their counts, sorted by count descending and by title ascending when counts tie.
Disney
November 29, 20260
0
0 solved
Given a list of play events where each event is a title name, return the k most played titles with their counts, sorted by count descending and by title ascending when counts tie.
An online assessment item in the style used for Disney Streaming roles, mirroring the trending and Top 10 rows on Disney+. The interviewer looks for a counting pass plus a size-k heap, and correct, deterministic tie-breaking.
What the Interviewer Expects
- Count plays with a hash map in one pass
- Use a min-heap of size k instead of sorting all titles when k is small
- Get tie-breaking right inside the heap ordering
- Return a deterministic order
- Compare O(n + m log k) with a full sort
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you compute this per country and per hour for the Top 10 row?
- What if the play stream is too large to count exactly?
- How would you exclude plays shorter than two minutes?
- How do you handle k larger than the number of distinct titles?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input is a list of strings, one per play. Output is up to k pairs (title, count). Ordering: higher count first; equal counts sorted alphabetically. If there are fewer distinct titles than k, ret...
High-Level Design
Count with Counter in O(n). Then keep a min-heap of size k whose root is the weakest candidate. The weakest item has the lowest count, and among equal counts the alphabetically largest title. Pyth...