This question evaluates a candidate's ability to design an in-memory, FIFO event registration service using object-oriented design, testing knowledge of data structures, state management, and efficient removal operations.
Design an in-memory service (OOD-style) to manage registrations for an event where fairness means users are served strictly in the order they registered (FIFO).
Users can:
k
users in the current fair order
Define and implement these operations:
register(userId)
unregister(userId)
topK(k) -> List<userId>
(return the earliest
k
currently-registered users)
unregister
efficiently.
Login required