UBER | SDE2 | Screening Round | BPS Interview |
Summary
I had a 1-hour screening round with Uber for an SDE2 role, where the interviewer was interested in my approach and thought process for a problem involving the design of a seat allocation system for an Uber Shuttle.
Full Experience
Question
There is an Uber Shuttle with n seats arranged in a single row, labeled from 0 to n - 1.
When a rider hops onto the shuttle, they instinctively look for the comfiest spot—the seat that puts them as far away as possible from the nearest fellow rider. If more than one seat offers the same level of personal space, W the rider politely chooses the seat with the lowest number. If the shuttle is completely empty, the first rider claims seat 0 (front row energy).
- Design a class that simulates how riders choose and leave seats on the Uber Shuttle.
- Implement the UberShuttle class:
- UberShuttle(int n) - Initializes the shuttle with n seats.
- int board() - Returns the seat number where the next rider decides to sit.
- void dropOFf(int p) - The rider sitting at seat p is dropping off from the shuttle
It was a 1 hour round, where the interviewer was trying to understand my approach and how am I thinking about the problem.
Interview Questions (1)
Uber Shuttle Seat Allocation
There is an Uber Shuttle with n seats arranged in a single row, labeled from 0 to n - 1.
When a rider hops onto the shuttle, they instinctively look for the comfiest spot—the seat that puts them as far away as possible from the nearest fellow rider. If more than one seat offers the same level of personal space, W the rider politely chooses the seat with the lowest number. If the shuttle is completely empty, the first rider claims seat 0 (front row energy).
Design a class that simulates how riders choose and leave seats on the Uber Shuttle.
Implement the UberShuttle class:
- UberShuttle(int n) - Initializes the shuttle with n seats.
- int board() - Returns the seat number where the next rider decides to sit.
- void dropOFf(int p) - The rider sitting at seat p is dropping off from the shuttle