Capacity To Ship Packages Within D Days
MediumLeetCodeBinary Search on Answer
Approach hintTry it first, then revealHide
For a fixed capacity, a greedy pass that loads packages until the next one would overflow gives the fewest days. Binary search the capacity between the heaviest package and the total weight.