Trains the technique from
LeetCode 1011Capacity To Ship Packages Within D DaysThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A ceramics studio has one kiln and a queue of unfired pieces. The queue is given as masses, where masses[i] is the clay mass in grams of the piece standing at position i. Pieces leave the queue from the front only, so they are fired in exactly the listed order and are never rearranged.
The studio has booked sessions kiln runs. A single run takes some number of pieces off the front of the queue, which means each run fires one contiguous block of the queue, and it may take none at all. The kiln is rated for a load ceiling: the combined mass loaded into any one run may not exceed it.
Return the smallest load ceiling for which sessions runs are enough to fire the entire queue. A run is never split across sessions, and a piece is never fired twice.
Example 1
With a ceiling of 11 the runs can be 9 | 4, 6 | 3, 8. Dropping to 10 forces the trailing 3 and 8 apart, which needs a fourth run.
Example 2
Four runs are booked for four pieces, so each run can hold one piece and the ceiling only has to cover the heaviest piece.
Example 3
A single run must swallow the whole queue, so the ceiling equals the total mass of 13 grams.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def kiln_load_ceiling(masses: list[int], sessions: int) -> int:public int kilnLoadCeiling(int[] masses, int sessions)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.