Sign in to keep reading
“LeetCode” is free with an account. Your progress and bookmarks follow you across devices.
Sign in to continueDesign LeetCode - This system design covers code execution infrastructure, sandboxed runtime environments, fan-out result delivery, and scalable submission processing at scale.
“LeetCode” is free with an account. Your progress and bookmarks follow you across devices.
Sign in to continueThink Beyond the Happy Path
Could you answer these today? Tick what you already know.
Design a coding challenge platform like LeetCode that allows users to browse coding problems, write solutions in multiple programming languages, and receive automated judging results. The system should:
FR1 – View and Search Questions
Users should be able to view and search a list of coding questions based on difficulty level, topic/tag, question name, and completion status.
FR2 – Code Solutions
Users should be able to view a question and code a solution using an in-browser IDE that supports multiple programming languages.
FR3 – Submit and Judge
Users should be able to submit a solution and receive submission results (pass/fail, runtime, memory usage) from the automated judging system.
NFR1 – High Availability
The system should be highly available for common operations including viewing/searching questions, accepting code submissions, and returning submission results.
NFR2 – High Scalability
The system should be scalable to support 10K concurrent submissions and handle peak loads of 5X during competitions.
NFR3 – Low Latency
The system should be efficient and return submission results within ≤ 5 seconds.
NFR4 – Security and Isolation
The system must support isolation and security when executing user-submitted code to prevent malicious code from compromising the infrastructure.
Security and isolation are critical non-functional requirements for LeetCode-like systems, particularly those using a scheduler-worker pattern. The fundamental principle is that each worker must operate in complete isolation, ensuring that a failure in one worker cannot affect others, effectively containing the "blast radius" to a single runtime environment. For code execution specifically, all user submissions must run in sandboxed environments with strict resource limits on CPU, memory, and network access to protect against malicious code. This isolation-first design is essential for maintaining system stability and preventing single points of failure from compromising the entire judging infrastructure.
Requirement Summary
| Functional Requirements (FRs) | |
|---|---|
| Name | Description |
| 1. View and Search Questions | Browse and search coding questions by difficulty, topic, name, or completion status. |
| 2. Code Solutions | Write solutions in an in-browser IDE supporting multiple programming languages. |
| 3. Submit and Judge | Submit solutions and receive automated judging results (pass/fail, runtime, memory). |
| Non-Functional Requirements (NFRs) | |
|---|---|
| Name | Description |
| 1. High Availability | System remains operational for viewing, searching, and submitting. |
| 2. High Scalability | Support 10K concurrent submissions with 5X peak capacity. |
| 3. Low Latency | Return submission results within ≤ 5 seconds. |
| 4. Security and Isolation | Execute untrusted code in isolated, sandboxed environments. |
While LeetCode offers many features, during system design interviews it's recommended to focus on core features first, then potentially expand into one or two additional domains where you have expertise. For example:
You could combine core features with: