Get your boarding pass

Matching riders with nearby drivers: a system design interview question

A ride-hailing startup matches by scanning all drivers in a city. Design real-time matching that scales to many cities. It is a senior-level question of about 45 minutes, and it starts from a system that already works, which is how many real design interviews begin.

How do I approach the matching riders with nearby drivers question?

To design ride matching, keep the latest driver locations in memory partitioned by area, with a geospatial index so a search touches a few cells instead of every driver. Model ride offers as a state machine with a lease per driver, and partition by city for scale and failure isolation.

Practise this design interview

The situation

A ride-hailing startup runs in one city. Drivers send their location every few seconds and the server stores the latest in a table. To match a rider it scans every driver, computes distances, and picks the closest available one.

What you are asked to design

Grow to 100 cities and 500,000 drivers sending a location every four seconds. Design the location pipeline and the matching: find nearby available drivers in under a second, avoid offering the same driver to two riders, and keep working if a server or a whole region fails.

Questions worth asking first

How accurate must locations be, and how stale can one get before we ignore it?

What does a good match mean: nearest, soonest pickup, or fair across drivers?

How do we handle a driver who declines or does not answer?

Is the system partitioned by city, or do users cross regions?

Where interviewers dig

A geospatial index (geohash, quadtree or similar) to find nearby drivers without scanning all.

The write rate of location updates and where the latest location lives.

Offering a ride to a driver exactly once, with timeouts and the next candidate.

What a strong answer covers

Computes the load: about 125,000 location updates a second, which rules out writing each to a relational table.

Keeps latest locations in memory or a fast store partitioned by area, with a geospatial index so a query touches a few cells, and archives history separately.

Models matching as a state machine (offered, accepted, declined, expired) with a lock or lease per driver so two riders cannot get the same driver.

Partitions by city or region for scale and failure isolation, and explains failover and what stale data costs.

Traps that cost points

Writing every location update to a durable relational database.

Offering the same driver to several riders at once and sorting it out afterwards.

Ignoring edge cases at cell borders when searching nearby.

How the practice works here

It works on a laptop or desktop, not on a phone: the canvas and the interviewer's view of your drawing need the screen space.

You talk with the interviewer by voice, and the canvas already shows the company's system as it is today. You extend it, and the interviewer sees what you draw. A button pauses your microphone when you want to think or sketch in silence; the interviewer waits.

When the time is up you get a report: a hire or no-hire call for the level, ratings for problem navigation, solution design, technical depth and communication with a quote from your own answer for each, what to fix, and the points a strong answer covered that yours did not. Your first interview on giveinterview, of any kind, is free, and every interview report is free. After that a design interview costs credits at the same per-minute rate as a role interview, and playing duels earns credits you can spend on it.

Frequently asked questions

How long is this design interview?

About 45 minutes, the length of a typical senior-level design round.

Can I do it on my phone?

No. System design practice needs a computer screen for the canvas, so it is for laptops and desktops only.

Do I have to draw?

Yes. The canvas starts with the current system and the interviewer sees what you add, as at a whiteboard. You can pause your microphone to sketch and explain afterwards.

Is it free?

Your first interview on giveinterview, of any kind, is free, and every interview report is free. After that a design interview costs credits at the same per-minute rate as a role interview, and playing duels earns credits you can spend on it.

Keep reading