Design a subscription push service
Company: Optiver
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
Design an object-oriented publish/subscribe notification service for user–topic subscriptions. Implement APIs: addSubscription(userId, topicId), unsubscribe(userId, topicId), publishNews(topicId, newsId, payload), and onNewsReceived(userId, newsId) to acknowledge delivery. Ensure each published item is delivered at most once to currently subscribed users, that unsubscribes prevent future deliveries, and provide per-topic per-user ordering guarantees. Describe class/interface design, in-memory and persistence data models, concurrency control, failure handling, and how you would scale to millions of users. Analyze the time and space complexity of core operations.
Quick Answer: This question evaluates object-oriented system design skills and knowledge of publish/subscribe messaging, delivery semantics (at-most-once delivery, ordering, idempotency), concurrency control, persistence models, failure handling, and scalability in the System Design domain.