← Questions

Price rides with fairness and pooling

0
AmazonSystem designLast asked Sep 2025

A system design interview question asked in Amazon's system design round, last asked Sep 2025. It tests pricing, ride-hailing and object-oriented design.

Design the pricing engine of a ride-hailing platform, and write its core price calculation. It should earn the company as much revenue as it can while staying fair to riders and drivers. Given a ride request, it returns several candidate routes with a price for each, and it prices pooled rides where riders share a car.

Requirements

  • Functional: an API that takes a request (pickup, drop-off, pool or not) and returns candidate routes, each with a price and a breakdown; prices from distance, duration, demand and supply, waiting time and driver incentives; pooled prices that account for shared segments and detours; fairness rules (a cap on surge multipliers, equitable prices across neighbourhoods, a transparent breakdown); experiments with pricing strategies behind guardrails; real-time updates of demand and driver supply.
  • Non-functional: a quote in under a few hundred milliseconds; a quoted price honoured for a few minutes; consistent prices for riders in the same place at the same time; auditable.

Clarifying questions

  • Is revenue the only objective, or also rides completed and driver earnings?
  • How is a fairness rule defined: a maximum surge, a maximum price gap between neighbourhoods for the same trip?
  • How long is a quote valid?
  • In a pool, is a rider's price fixed at booking, or can it change when another rider joins?

What a strong answer covers

  • Components: a quote API, a routing service for candidate routes with distance and time, a supply-demand service that computes surge per area from live requests and driver locations in short windows, the pricing function, a rule and experiment configuration store, and a quote store so the accepted price is the one charged.
  • The price function, written out: base + per_km · distance + per_min · duration, times a surge multiplier clamped to the cap, plus fees and incentives, minus pooling discounts, rounded; inputs, outputs and O(1) cost per route.
  • Pooling: each rider pays for their own distance, discounted for the share of the trip that is shared, and compensated for the expected detour; the total stays above the driver's cost.
  • Fairness: caps applied after every other factor; surge zones smoothed so neighbouring areas do not differ sharply; regular audits of price by neighbourhood for comparable trips.
  • Experiments: strategies chosen by area or time, never by individual rider, with guardrails (price limits, automatic stop on bad metrics).

Follow-ups

  • Demand spikes after a concert. How does surge react without oscillating?
  • How do you show that a pricing strategy does not disadvantage some neighbourhoods?
  • Another rider joins a pool after the first was quoted. What does each pay?

Where it's asked

What it tests

pricing · ride-hailing · object-oriented design

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing