Pick Featured Show Slots To Maximize Promoted Revenue

Last updated: November 29, 2026

Quick Overview

The homepage has one featured carousel position and a list of candidate shows, each with a start time, end time, and expected revenue if featured. Choose non-overlapping shows to feature that maximize total expected revenue and return both the revenue and the chosen shows.

Whatnot
Coding & Algorithms
Software Engineer
Whatnot
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


The homepage has one featured carousel position and a list of candidate shows, each with a start time, end time, and expected revenue if featured. Choose non-overlapping shows to feature that maximize total expected revenue and return both the revenue and the chosen shows.

Whatnot promotes live shows in prime discovery spots, and only one show can hold a given slot at a time. The interviewer is looking for weighted interval scheduling with a sort plus binary search, and for reconstruction of the chosen set, not just the number.

What the Interviewer Expects
  • Explain why greedy by end time fails when revenues differ
  • Sort by end time and define dp over prefixes
  • Use binary search to find the last compatible show
  • Reconstruct the chosen shows
  • Treat intervals as half-open so back-to-back shows fit
Key Topics to Cover
1D dynamic programming
weighted interval scheduling
binary search
reconstruction
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 there are two featured positions instead of one?
  • How would you add a rule that one seller cannot be featured twice in a row?
  • Expected revenue is a model estimate. How would you account for its uncertainty?
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: (start, end, revenue) with half-open intervals. Output: maximum total revenue and the list of shows chosen, in time order. Empty input gives (0, [])....

High-Level Design

Sort shows by end time. Let dp[i] be the best revenue using only the first i shows. For show i, either skip it (dp[i-1]) or take it and add its revenue to dp[j], where j is the number of earlier...


Submit Your Answer
Markdown supported

Related Questions