System Design

Ride Matching Interview Questions

How would you design Uber / a ride-hailing matching system? — spoken sample answer for Indian interviews.

  • 5Questions with answers
  • 3Difficulty levels

Questions (5)

Browse beginner, intermediate, and advanced questions with answers — hide them when you want to self-test.

Question 1
Interview Advanced
Question

How would you design Uber / a ride-hailing matching system?

Answer:

The core loop is: rider requests a trip, we find nearby idle drivers, offer, accept, then track. Drivers send GPS every few seconds. I would not scan all drivers. I bucket locations into geohash or S2 cells in Redis and query neighboring cells. Matching ranks by ETA, rating, and maybe destination. The dangerous bug is double-booking a driver. I would take a lock or compare-and-set on driver status so one trip wins. Trip is a state machine: requested, matched, en route, ongoing, completed. ETA comes from a routing service. Surge is demand versus supply per cell. I would say payments and fraud exist but I would not design the whole payments ledger in the first 20 minutes unless they ask. Consistency matters on 'one driver, one trip' more than on the last GPS ping.

Question 2
Interview Intermediate
Question

How do you match a rider to a nearby driver without scanning the whole city?

Answer:

I keep drivers in a geo index — geohash or a quadtree / Redis GEO. When a ride is requested I query a small radius, filter by availability and vehicle type, then offer to the best few. I expand radius if nobody accepts. I would not run SQL LIKE on lat long for every request. Surge and ETA are computed on that candidate set. The geo index is the heart of matching.

Question 3
Interview Advanced
Question

What happens when two riders get the same driver?

Answer:

The offer must be transactional. I would hold the driver with a short lease in Redis or a compare-and-set on driver state. The second request sees the driver as busy and moves to the next. If the driver rejects, the lease expires and matching retries. I would not assign in memory without a lock. Double-assign is the classic race. I mention it before they ask.

Question 4
Interview Intermediate
Question

How do you show ETA and why is it often wrong?

Answer:

ETA is a model: distance from map services plus traffic plus the driver's recent speed. I would cache map tiles and traffic, not call a third party on every UI poll. I would update ETA as the driver moves. I would tell the interviewer that ETA is approximate and that over-promising is a product bug. Matching nearby does not equal a good ETA if the driver is on a one-way flyover.

Question 5
Interview Advanced
Question

How would you design surge pricing without surprising users?

Answer:

I compute demand versus supply in a geohash cell over a short window. Surge is a multiplier with a cap. I would show it before the user confirms. I would not change the price after they accept unless policy says so. I store the quoted multiplier with the trip. Internally I still need the geo demand counters. I would mention fairness and that I would not surge a stalled GPS glitch from one driver.

Practice with AI mock interviews

Run System Design mock interviews with AI follow-ups, instant feedback, and analytics on AiLx.

Free to start · No credit card required