Split Seller Lot Queue Into K Shows Minimizing Longest Show

Last updated: November 29, 2026

Quick Overview

A seller has an ordered queue of lots with estimated selling durations and wants to run them across exactly k or fewer back-to-back livestream shows without reordering. Return the smallest possible length of the longest show.

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

0

0

0 solved


A seller has an ordered queue of lots with estimated selling durations and wants to run them across exactly k or fewer back-to-back livestream shows without reordering. Return the smallest possible length of the longest show.

Whatnot sellers plan shows around a run sheet of lots, and breaking a long run sheet into evenly sized shows keeps viewers engaged. The interviewer is checking whether you spot that feasibility is monotonic in the cap and binary search on the answer instead of trying DP first.

What the Interviewer Expects
  • Notice that if a cap works, every larger cap works
  • Write a greedy feasibility check that packs lots in order
  • Binary search between the largest lot and the total
  • Explain why greedy packing is optimal for a fixed cap
  • Compare with the O(n^2 k) DP
Key Topics to Cover
binary search on answer
greedy feasibility
partitioning
monotonic predicate
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
  • How would you return the actual split points, not just the cap?
  • What if each show also has a fixed setup overhead?
  • What if durations are real numbers instead of integers?
  • Can you allow moving one lot to a different show?
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: positive integer durations in fixed order and k >= 1. Split into at most k contiguous groups (fewer shows is allowed since it never helps to add empty ones). Minimize the maximum group sum....

High-Level Design

Guess a cap C and ask: can the queue fit into at most k shows with no show longer than C? Greedily fill a show until the next lot would overflow, then start a new show. If this needs at most k sho...


Submit Your Answer
Markdown supported

Related Questions