Maximize Sponsorship Revenue From Non-Overlapping Livestream Ad Bookings

Last updated: November 29, 2026

Quick Overview

A Douyin livestreamer receives sponsor bookings (start, end, payment) and can air only one at a time; return the maximum total payment from a set of non-overlapping bookings, where one may start exactly when another ends.

ByteDance
Coding & Algorithms
Software Engineer
ByteDance
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


A Douyin livestreamer receives sponsor bookings (start, end, payment) and can air only one at a time; return the maximum total payment from a set of non-overlapping bookings, where one may start exactly when another ends.

Livestream commerce is core to Douyin, and slot planning for hosts is a natural ByteDance onsite framing for weighted interval scheduling. The interviewer checks that you combine sorting, DP and binary search, and that you explain why greedy by payment or by end time fails.

What the Interviewer Expects
  • Show a counterexample to greedy approaches
  • Sort by end time and define dp over prefixes
  • Use binary search to find the last compatible booking
  • Handle the touching-endpoint rule with the right bisect variant
  • State O(n log n) time
Key Topics to Cover
dynamic programming
binary search
interval scheduling
sorting
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
  • Return which bookings were chosen.
  • The host can run two sponsor overlays at once: what changes?
  • Bookings arrive online and must be accepted or rejected immediately.
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: list of (start, end, pay) with start < end and pay > 0. Bookings touching at endpoints are compatible. Output: maximum total pay. Expect n up to 10^5, so O(n^2) is too slow....

High-Level Design

Sort bookings by end time. Let dp[i] be the best revenue using only the first i bookings. For booking i, either skip it (dp[i-1]) or take it and add the best result among bookings that end at or befor...


Submit Your Answer
Markdown supported