Validate Mid-Roll Ad Break Cue Points for a Movie
Last updated: November 29, 2026
Quick Overview
Given a title's runtime and a list of proposed mid-roll breaks as (cue point, pod duration) pairs, return every rule violation: no ads in the opening minute, cue points inside the runtime, pods capped at 120 seconds, and at least 7 minutes of content between breaks.
Tubi
November 29, 20260
0
0 solved
Given a title's runtime and a list of proposed mid-roll breaks as (cue point, pod duration) pairs, return every rule violation: no ads in the opening minute, cue points inside the runtime, pods capped at 120 seconds, and at least 7 minutes of content between breaks.
Tubi earns all of its revenue from ads inserted into free movies and shows, so cue point metadata from content ops feeds straight into ad insertion. A phone screen warm-up like this checks that you can turn business rules into clean, ordered checks and report useful errors instead of a bare true or false.
What the Interviewer Expects
- Sorts the breaks before comparing neighbours instead of assuming input order
- Reports every violation with enough context to fix it, not just the first
- Handles duplicates and breaks at or past the runtime
- Keeps the thresholds as parameters rather than magic numbers
- States O(n log n) time and explains why the sort dominates
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 also enforce a cap on total ad seconds per hour of content?
- If cue points come from automatic scene detection, how would you snap an invalid cue to the nearest valid one?
- How would the rules change for a live FAST channel instead of on-demand content?
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: content_len in seconds and breaks, a list of (cue, pod_seconds). Output: a list of violation strings, empty if the schedule is valid. Rules (parameterized): no cue before no_ad_head (60...
High-Level Design
Sort by cue point, then walk once. Each break is checked on its own (range, pod length) and against the previous cue (duplicate or too close). Collecting all violations is friendlier to the content op...