Code Room
CodingMediumcod-g090
Subject Binary searchLevel Mid–Senior~30 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Packages with given integer weights must be shipped in their given order within at most 'days' days. Each day you load consecutive packages onto a ship without exceeding its capacity. Return the minimum ship capacity that lets you ship everything within 'days' days. Assume 1 <= days <= len(weights).

Implement
min_ship_capacity(weights: list[int], days: int) → int
Examples
in[[1,2,3,4,5,6,7,8,9,10],5]out15
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.