Lesson 2 of 15
44. Design Ride-Hailing with Surge Pricing (Uber / Rapido)

44.1 What do you ask first?

3 min read+10 XP

Step 1: Requirements (5 minutes)

LetterCandidate asksInterviewer answers
Scope"Cars, bikes, autos? Shared rides? Scheduled rides? Payments in scope? Driver earnings?""Cars and bikes, single rider. On-demand only. Payment at the end (cash or digital). Skip earnings."
Count"How many drivers and rides?""Up to a million drivers online at peak; about 20 million rides a day across cities."
Access pattern"How often do drivers send location?""Every 4 seconds while online."
Latency"How fast must a match happen?""A driver should be assigned within seconds; the rider sees the car move live."
Exactness"Can a driver get two riders? Can the price change after booking?""Neither. The quoted price is what the rider agrees to."

Agreed requirements:

  • Functional (verbs): drivers go online and stream their location; riders request a ride and see a price quote (with surge); the system matches a nearby driver, tracks the trip live, and completes it with a fare.
  • Non-functional (adjectives): fast matching (seconds), live tracking, never double-assign a driver, consistent trip state despite flaky phones, scalable location ingestion, fair and stable prices, available per city.

Interviewer pushback:

  • "Is 'nearest driver' the right goal?" → Nearest by arrival time, not straight-line distance. A driver across a river can be closest on the map and slowest to arrive (44.7).

Memory code: "Ask how many move, how often they report, and what can never happen twice."