Design ride-hailing pricing with fairness and pooling
Company: Amazon
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Onsite
Design and implement a pricing engine for a ride-hailing platform that maximizes company revenue while ensuring fairness to riders and drivers. Requirements:
1) Expose an API that, given a user request, returns multiple candidate routes for the rider to choose;
2) Compute a price for each candidate route using distance, duration, demand/supply, waiting time, and driver incentives;
3) Support carpooling: when a rider opts into pooling, compute the rider’s price considering shared segments and detours;
4) Enforce fairness constraints (e.g., caps on surge multipliers, equitable pricing across neighborhoods, transparent breakdowns);
5) Allow experimentation with pricing strategies and guardrails;
6) 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.
Quick Answer: 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.