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: Design a subscription push service evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.