Algorithm · DoorDash · Medium
Requirements Input consists of an ordered list of timepoints, a per-batch limit B, and a time-span limit W. Partition the timepoints into batches while satisfying both conditions below: No batch may contain more than B timepoints. Within any one batch, the difference between its latest and earliest timepoints must be at most W. Return the smallest possible number of batches. Follow-up: recast the scenario as riders collecting orders. Given pickup intervals, determine the…
Checking your access…