Lyft logo

Lyft Software Engineer System Design Questions

15 practice questions for Lyft Software Engineer interviews

Lyft software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer

No verified questions yet for Lyft.

system design Medium api design #1

1. Design DriverRiderMatcher — a service for efficiently matching drivers with riders based on real-time demand and supply conditions.


Background: Lyft aims to enhance user experience by ensuring that riders can be matched quickly to nearby drivers. This service would handle the complexities of demand and supply fluctuations in real-time.
Requirements:
1. The service should allow adding new Driver and Rider instances dynamically as they request a ride or become available.
2. The system must prioritize matching riders with the nearest available driver to minimize wait times.
3. It should support cancellation of ride requests by riders or drivers, updating the available pool appropriately.
4. The service must track ongoing rides and maintain a history of matches for potential analytics.
Class API:
  • add_driver(driver_id: int, location: Tuple[float, float]) -> None: Adds a new driver to the service with a given ID and location.

  • add_rider(rider_id: int, location: Tuple[float, float]) -> None: Registers a new rider with a given ID and location.

  • request_ride(rider_id: int) -> Optional[int]: Matches the rider with the nearest driver, returning the driver's ID or None if no driver is available.

  • cancel_ride(rider_id: int) -> None: Cancels the ride request for the specified rider, freeing up any matched driver.


Example 1:
Input: add_driver(101, (37.7749, -122.4194)) → Output: None
Input: add_rider(201, (37.7750, -122.4192)) → Output: None
Input: request_ride(201) → Output: 101 (implying rider 201 has been matched with driver 101)
Example 2:
Input: add_driver(102, (37.7799, -122.4294)) → Output: None
Input: cancel_ride(201) → Output: None
Constraints:
  • Driver and Rider IDs must be unique integers.

  • Locations are represented as tuples of floating-point latitude and longitude values.

  • The system should handle up to 10,000 drivers and 10,000 riders concurrently.

Related Lyft Software Engineer interview prep

Start practicing Lyft questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free