Design an UberShuttle class that seats riders as far from each other as possible.
Unlock detailed company stats for this questionUpgrade
An Uber Shuttle has n seats in a single row, labeled 0 to n - 1. A rider boarding picks the seat that is as far as possible from the nearest rider. If several seats tie, the rider takes the lowest number. If the shuttle is empty, the first rider takes seat 0. Implement the UberShuttle class:
- UberShuttle(int n): initializes the shuttle with n seats.
- int board(): returns the seat number where the next rider sits.
- void dropOff(int p): the rider sitting at seat p leaves the shuttle.
Community answers
No answers contributed by the community yet.
Related courses

Course

Course
Course
