Algorithm · DoorDash · Hard
A delivery platform needs a function that calculates total courier earnings across a batch of orders. Time is measured in integer minutes. Every interval is half-open: for a range [start, end), a minute t is included when $$start \le t < end$$. In the first version, each order is given as [acceptedAt, deliveredAt]. The platform uses a per-minute base rate $$rate$$. During any minute, let $$k$$ be the number of orders covering that minute. Each of those $$k$$ orders earns…
Checking your access…