1. Top 6 Recently Asked Uber System Design Questions
Category: Graph system design problemThis collection covers the most frequently asked system design questions at Uber interviews.Input: Graph (nodes and edges) Output: Computed result
Want to practise this one?
Create a free account to open the full question and practise Uber questions with AI.
1. [OA] Job Scheduler — a system to organize Uber's driver's shifts
Managing a flexible and efficient scheduling system for Uber drivers is crucial for operational efficiency. This problem will assess your ability to design a job scheduler that can optimally organize drivers' shifts.Problem statement: Design a class JobScheduler with the following methods:
addJob(driverId: int, startTime: int, endTime: int): Adds a job for a driver within specific time bounds.
getSchedule(driverId: int) -> List[Tuple[int, int]]: Returns a list of scheduled jobs for a driver.
Example 1: Input: JobScheduler scheduler = new JobScheduler(); scheduler.addJob(1, 1, 5); scheduler.addJob(1, 6, 10); scheduler.getSchedule(1) Output: [(1, 5), (6, 10)] Explanation: Driver 1 has two scheduled jobs.Constraints:
1 <= driverId <= 10^6
1 <= startTime < endTime <= 10^9
Want to practise this one?
Create a free account to open the full question and practise Uber questions with AI.
2. [OA] RateLimiter — implement a rate-limiting feature for Uber APIs
In order to protect Uber's services from abuse and ensure fair usage, we need a reliable rate-limiting mechanism that tracks requests from users over a given time window.Problem statement: Design a RateLimiter class with the following methods:
RateLimiter(limit: int, timeWindow: int): Constructor that initializes a rate limiter allowing limit requests every timeWindow seconds.
allowRequest(userId: int) -> bool: Returns true if the request is allowed, or false if the limit is exceeded.
Example 1: Input: RateLimiter rateLimiter = new RateLimiter(3, 10); rateLimiter.allowRequest(1) => Output: true rateLimiter.allowRequest(1) => Output: true rateLimiter.allowRequest(1) => Output: true rateLimiter.allowRequest(1) => Output: false Explanation: User 1 can make 3 requests in 10 seconds, and the fourth request is denied.Constraints: