Company: Google
Difficulty: medium
Convoy Load Balancing With Escort Weight Captain Reyes runs a supply convoy along a single desert highway. The crates waiting at base camp are lined up in a fixed order on the loading dock, and that order can never be changed - trucks must scoop up a contiguous run of crates exactly as they sit on the dock. Every truck that heads out also drags a fixed escort trailer, whose weight is added once to whatever load the truck is already carrying. On top of that, dock safety rules cap how many crates a single truck can physically hold, regardless of how light those crates are. Reyes has a fixed number of trucks available and must use every single one of them, dividing the full line of crates into that many non-empty convoys, with no convoy exceeding the crate-count cap. Reyes wants to know the smallest possible value for the heaviest truck's total load (crates plus its escort trailer), if the crates are split as cleverly as possible into that many contiguous, cap-respecting groups. Function