Engineering Problems
Canonical system design, coding, and architecture problems with staged solutions. Attempt before revealing the reference answer β each problem connects back to the concepts it teaches.
How problem workspaces work
Design a URL Shortener
Design a URL shortening service similar to bit.ly or TinyURL. Users submit a long URL and receive a short alias (e.g., https://short.ly/aB3xY). When a user visits the short URL, the service redirects them to the original. The service must handle high read traffic, provide low-latency redirects, and allow optional analytics per short URL.
Design a Distributed Rate Limiter
Design a rate limiter for a public API that enforces per-user and per-IP request limits at scale. The service must handle high throughput, be deployable across multiple data center regions, and gracefully degrade when the rate-limiting backend is unavailable.
Design a Notification Service
Design a notification service for a social media platform. The service must deliver notifications to users via push (mobile), email, and in-app channels. Notifications are triggered by user events (likes, comments, follows, mentions). The system must be reliable, handle notification preferences, and avoid spamming users.
Implement an LRU Cache
Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement get(key) and put(key, value) operations in O(1) average time complexity. When the cache reaches its capacity, it should invalidate and evict the least recently used key before inserting a new item.
Top K Frequent Elements
Given an integer array nums and an integer k, return the k most frequent elements. The algorithm's time complexity must be better than O(N log N), where N is the array's size.
Design a Distributed Unique ID Generator
Design a globally distributed unique ID generation service (similar to Twitter Snowflake). Generated IDs must be 64-bit integers, globally unique, roughly time-sortable, and generated at high scale without cross-node network coordination.
Design a Thread-Safe Bounded Blocking Queue
Design and implement a thread-safe Bounded Blocking Queue with put(element) and get() methods. When the queue is full, producer threads calling put() must block until space becomes available. When the queue is empty, consumer threads calling get() must block until an element is added.
Design a Distributed Key-Value Store
Design a distributed, highly available key-value store similar to DynamoDB or Cassandra. The system must support put(key, value) and get(key) across multiple storage nodes with configurable consistency, automatic data partitioning, and failure recovery.
Design a Circuit Breaker for Microservices
Design a resilient Circuit Breaker pattern to protect distributed microservices from cascading failures when downstream dependencies degrade or fail. The breaker must support Closed, Open, and Half-Open states with automatic recovery testing.
Course Schedule & Cycle Detection
There are numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [a, b] indicates that you must take course b before course a. Determine if you can finish all courses (i.e. check if the prerequisite graph is a Directed Acyclic Graph / DAG).
All problems are human-reviewed canonical content. Revealing a reference solution records activity only β demonstrated competence requires a submitted attempt evaluated against the problem criteria. Browse concepts β
