Courier Pay from Order Intervals via a Service Client

Asked at DoorDash · Coding Questions · Difficulty: Medium · Last asked Apr 29, 2026

A delivery courier ("dasher") is paid a fixed rate per minute for the time spent on completed orders. Order data is provided by a service object that returns, for a given courier id, the list of completed order intervals `(start, end)`. Compute the courier's pay and wrap the computation in a small client class, keeping the pay algorithm independent from where the data comes from.

Loading the problem…