Compute Audible Time in a VOD After Copyright Muting

Last updated: November 29, 2026

Quick Overview

A VOD of `duration` seconds has a list of muted audio intervals [start, end) produced by a copyright scanner; intervals may overlap, touch, or extend past the video. Return the total number of audible seconds and the merged list of muted ranges for the player's scrub bar.

Twitch
Coding & Algorithms
Software Engineer
Twitch
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


A VOD of `duration` seconds has a list of muted audio intervals [start, end) produced by a copyright scanner; intervals may overlap, touch, or extend past the video. Return the total number of audible seconds and the merged list of muted ranges for the player's scrub bar.

Twitch mutes segments of past broadcasts when a scanner matches copyrighted audio, and the player shows those segments on the timeline. The interviewer is looking for clean interval merging, correct clipping to the video bounds, and attention to half-open intervals.

What the Interviewer Expects
  • Clips each interval to [0, duration) before merging
  • Sorts by start and merges overlapping and touching intervals
  • Treats intervals as half-open and explains why touching ranges merge
  • Computes audible time as duration minus merged muted length
  • Returns the merged list in a form the UI can render directly
Key Topics to Cover
Interval merging
Sorting
Clipping
Half-open ranges
Media timelines
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • The scanner emits intervals as a stream while the VOD is still processing. How do you maintain the merged set incrementally?
  • How would you answer 'is second t muted?' in O(log n) for the player?
  • If the scanner returns per-track mutes (music track vs game audio), how does the model change?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Given duration and a list of [start, end) pairs, possibly unsorted, overlapping, negative, or beyond the end, output (audible_seconds, merged_muted_ranges). Touching ranges such as [10,20) and [20,3...

High-Level Design

Normalize first: clamp each interval to the video and drop empty ones. Then sort by start and sweep, extending the last merged interval while the next start is at or before its end. Audible time is th...


Submit Your Answer
Markdown supported

Related Questions