← Amazon Interview Insights

Amazon·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Amazon SWE interview with a combined OOD and coding round. The core problem was building a single-machine Pub/Sub system from scratch, with priority queues thrown in to keep things interesting. Solid design problem but it moves fast.

Questions Asked (1)

Q1

Design and implement a simplified single-machine Pub/Sub system where users can subscribe to topics, with support for message priority.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

The priority part is what gets you.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints (e.g., single machine, expected throughput, priority levels, delivery guarantees). Then design the core components: topic management, subscription handling, and a priority-aware message queue, discussing data structures and trade-offs. Finally, outline the implementation details and potential optimizations.

Pro tip: Emphasize the trade-offs between different priority queue implementations (e.g., heap vs. multiple queues) and how they affect latency, throughput, and fairness. Also, mention how you would handle slow subscribers to prevent them from blocking the system.

1. Clarify Requirements and Constraints

Ask questions to understand the scope: expected message volume, number of topics/subscribers, priority levels, delivery semantics (at-least-once, at-most-once), and persistence needs.

2. High-Level Design

Outline the main components: a topic registry, subscriber registry, and a message broker that routes messages to subscribers based on topic and priority. Consider using a priority queue per subscriber or per topic.

3. Data Structures and Algorithms

Choose appropriate data structures: e.g., a min-heap or multiple FIFO queues for priorities, hash maps for topic/subscriber lookup. Discuss time complexity for publish and subscribe operations.

4. Implementation Details

Describe how to implement the core operations: publish (enqueue with priority), subscribe (register and receive messages), and unsubscribe. Address concurrency (locks, thread-safe queues) and message delivery (push vs. pull).

5. Trade-offs and Scalability

Discuss trade-offs: e.g., strict priority vs. fairness, memory usage, and potential bottlenecks. Mention how the design could scale to multiple machines if needed.

Key Points to Mention

  • Priority queue implementation (e.g., heap, multiple queues) and its impact on performance
  • Concurrency control for thread-safe publish/subscribe operations
  • Delivery guarantees and handling of slow or failed subscribers
  • Message persistence and durability options
  • Trade-offs between strict priority and fairness (e.g., starvation avoidance)
  • Potential bottlenecks and scalability considerations

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.