Design ride-hailing pricing with fairness and pooling
AmazonSoftware Engineer · OnsiteLast updated
This question evaluates system design and algorithmic skills related to real-time distributed pricing, API and data-flow architecture, carpooling logic, fairness constraints, and experimentation support.
Design and implement a pricing engine for a ride-hailing platform that maximizes company revenue while ensuring fairness to riders and drivers. Requirements:
- Expose an API that, given a user request, returns multiple candidate routes for the rider to choose;
- Compute a price for each candidate route using distance, duration, demand/supply, waiting time, and driver incentives;
- Support carpooling: when a rider opts into pooling, compute the rider’s price considering shared segments and detours;
- Enforce fairness constraints (e.g., caps on surge multipliers, equitable pricing across neighborhoods, transparent breakdowns);
- Allow experimentation with pricing strategies and guardrails;
- Handle real-time updates to demand and driver availability. Deliverables: a high-level system design covering components, data flows, and storage, plus pseudocode or code for the core price calculation function with inputs, outputs, and complexity. Discuss trade-offs, assumptions, and how you would validate fairness.
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.