Compute courier pay with peak-hour rules
DoorDashSoftware Engineer · Technical ScreenLast updated
This question evaluates a candidate's data manipulation skills and competency in implementing business rules, including robust error handling, aggregation for per-day totals, minimum-pay enforcement, and time-window (peak-hour) pay adjustments.
Implement compute_pay(deliveries) to calculate a delivery driver's daily pay from a list of delivery records. Each record may include times, miles, base rate, and tip. Requirements: robust error handling for missing/invalid fields and sensible defaults or skipping; enforce minimum pay per delivery; and produce a per-day total. Follow-up: add a configurable 'peak hour' rule that increases pay for deliveries whose start times fall within specified time windows.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.