Minimum Per-Second Bandwidth to Deliver Segments Before Deadline

Last updated: November 29, 2026

Quick Overview

A video is split into segments with given sizes in kilobytes that must be delivered in order. Each second, the CDN edge can send whole segments up to a bandwidth cap C, and a segment cannot be split across seconds. Find the minimum integer C that delivers all segments within D seconds.

TikTok
Coding & Algorithms
Software Engineer
TikTok
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


A video is split into segments with given sizes in kilobytes that must be delivered in order. Each second, the CDN edge can send whole segments up to a bandwidth cap C, and a segment cannot be split across seconds. Find the minimum integer C that delivers all segments within D seconds.

TikTok's player prefetches segments so the next video starts instantly, and capacity planning asks for the smallest bandwidth that meets a startup deadline. This technical screen tests binary search on the answer with a greedy feasibility check.

What the Interviewer Expects
  • Identifies the monotonic property: if C works, any larger C works
  • Sets search bounds at max(segment) and sum(segments)
  • Writes a greedy check that packs segments into seconds in order
  • Uses a lower-bound binary search pattern without off-by-one errors
  • States O(n log(sum)) complexity
Key Topics to Cover
binary search on answer
greedy
feasibility check
monotonicity
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
  • What if segments can be split across seconds?
  • How would you handle different caps per second, for example during peak hours?
  • How would you choose D in the first place given a target startup time?
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
  • Input: sizes: list[int] (positive), D: int >= 1.
  • Output: minimum integer C.
  • Segments must go in order and whole....
High-Level Design

Feasibility is monotonic in C: more bandwidth never hurts. So binary search C in [max(sizes), sum(sizes)]. The lower bound is required because the largest segment must fit in one second; the upper b...


Submit Your Answer
Markdown supported