Katkat

Calculate Daily Driver Pay

DoorDashSoftware Engineer · Technical Screen

Last updated

This question evaluates event-driven time-interval processing, interval-overlap arithmetic, rate computation, and robustness to malformed, duplicate, or unordered events when aggregating a driver's pay from a day's log.

You are given a one-day event log for a delivery driver. Each input record is a JSON event with fields such as order_id, event_type, timestamp, and base_rate_per_minute.

For each order, a valid pair of events defines a paid work interval: the order starts at its start event and ends at its completion event. The pay for that order is:

duration_in_minutes * base_rate_per_minute

Compute the driver's total pay for the day across all orders.

Follow-up: some time ranges are marked as peak periods, during which the pay rate is doubled. If a paid interval partially overlaps a peak period, you must split the interval at every peak boundary and apply the doubled rate only to the overlapping sub-intervals.

Assume timestamps are already normalized to comparable numeric values; timestamp parsing itself is not the focus. Also explain how you would handle malformed input such as missing events, duplicate events, or invalid event ordering.