FastPrepMinimum Riders for Delivery Intervals
Problems/Minimum Riders for Delivery Intervals

Minimum Riders for Delivery Intervals

DoorDash logoDoorDash● MediumFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The rider-allocation follow-up matches the report at about 90%. Fixed delivery intervals and same-time reuse are specified for practice.

Each delivery occupies one rider from its start time until its end time. Return the fewest riders needed to handle every delivery.

For this exercise, deliveries[i] = [start, end] is a fixed interval. A rider handles at most one delivery at a time. A delivery ending at time t releases its rider before another delivery starting at t. Deliveries may be given in any order. An empty list needs zero riders.

Function

minimumRiders(deliveries: int[][]) → int

Examples

Example 1

deliveries = [[1,4],[2,5],[4,6]]return = 2

At time 2, the first two deliveries overlap. At time 4, the first rider becomes free for the third delivery, so two riders are enough.

Example 2

deliveries = [[0,10],[2,7],[3,4]]return = 3

All three deliveries are active at time 3, so three riders are necessary and sufficient.

Example 3

deliveries = []return = 0

There are no deliveries to cover.

Constraints

  • 0 <= deliveries.length <= 100000
  • Each delivery has exactly 2 integers.
  • 0 <= deliveries[i][j] <= 10^9
  • Every delivery satisfies start < end.

More DoorDash problems

  • Customer Bootstrap APIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dasher Pay with Store Waits and Peak HoursPHONE SCREEN · Seen Nov 2026
  • Random Dasher Set OperationsONSITE INTERVIEW · Seen Nov 2026
All DoorDash interview questionsSee DoorDash hiring insights
Saved
public int minimumRiders(int[][] deliveries) {
    // Write your code here.
}
Checking account…