Practice problems modelled on OpenAI's coding, ML, system design and behavioral interviews.
Full problem statements, worked solutions, and code that CI runs on every push.
English · 中文
Note
Unofficial. This project is not affiliated with, endorsed by or sponsored by OpenAI. The problems are reconstructed from second-hand accounts of past interviews and written up from scratch: statements, examples, solutions and code are all original. Interviews differ between teams and change over time, so treat each page as practice on the kind of problem you may meet, not as the exact question. If you believe something here should not be public, open an issue and it will be taken down.
| Section | Problems | What they cover |
|---|---|---|
| Coding | 37 | Data structures, simulation, concurrency, parsing, object-oriented design and refactoring, plus twelve ML and maths problems: NumPy and PyTorch from scratch, derivations, debugging, reinforcement learning and probability |
| System design | 22 | Product and infrastructure systems (payments, chat, CI/CD, webhooks, device fleets) and four AI systems: inference serving, video generation, retrieval and agent evaluation |
| Behavioral & other | 4 | Recruiter screen, hiring-manager round, technical deep dive with slides, engineering management |
Alongside the problems, How the loop runs collects what community reports agree on about the process itself: how people get an interview, the shape of the loop, how problems are handed out in a round, and what decides the outcome.
What sets the pages apart:
- Complete statements. Each problem is written out in full, with definitions, function signatures and worked examples, so you can attempt it without guessing what was meant. Most coding problems come in two to five parts that build on each other.
- Solutions you can check. Every coding and system-design solution ends with a collapsed block of runnable checks. For coding, these are asserts on the examples and, wherever one can be written, a brute force built independently from the statement; for system design, the back-of-the-envelope estimates recomputed in code. CI runs the code of all pages on every push.
- Pitfalls where they happen. Instead of a separate list of mistakes,
# NOTE:comments sit on the line the mistake would be made. - Study tracks. The roadmap orders the problems for Research (RS / RE), MLE and SWE / Infra roles.
- English and Chinese. Every page exists in both languages with identical code.
Read how the loop runs once, then start from the track for your role in the roadmap. ★ shows how often a question comes up, from ★★★★★ (again and again) to ★☆☆☆☆ (rarely), and each track is sorted so that the top of the list pays off first.
| Time you have | Research (RS / RE) | MLE | SWE / Infra |
|---|---|---|---|
| About a week | stages 1–3, and start the deep-dive and hiring-manager stories | everything rated ★★★★☆ or higher | everything rated ★★★★☆ or higher |
| Two to four weeks | all six stages | the whole track | the whole track |
| More than that | add the ★★★★☆ problems of the other tracks | add the Research stages you skipped | add the ML coding core if the team works close to models |
Coding. Read only the Problem section. Before writing code, note what you would ask the interviewer
(edge cases, tie-breaking, input sizes), then compare with the first lines of the reference solution, which list
the points worth confirming. Give yourself a time limit for the whole problem and take the parts in order,
treating each new part as a change of requirements: extend your code instead of starting over. Run it on the
examples, then open the reference solution and compare approach, complexity and the # NOTE: comments. The
checks call the functions named in the statement, so if you keep the same names and signatures you can usually
run them against your own code.
System design. Give yourself about an hour (the page header shows the length of the round where it is known) and work through the prompt out loud or on paper: requirements, estimates, API and data model, architecture, then two or three deep dives. Then compare with the reference solution: which requirement you missed, where your numbers differ, which failure you did not handle. The estimates are computed in the checks block, so you can change an input and rerun them.
Behavioral. Each page lists what the round probes and how a strong answer is structured, and ends with an outline to fill in with your own stories. Rehearse them aloud, and keep your filled-in version private.
Every page starts with a table (type, priority, difficulty, roles, topics and, where known, format and round) and has exactly two sections:
| Section | Coding | System design | Behavioral |
|---|---|---|---|
| Problem | definitions, then one block per part: task, signature, example | the system, its users, the numbers given, the scope | the round and its questions |
| Reference solution (collapsed) | per part: idea, derivation, code, with pitfalls as # NOTE: comments; then follow-ups and the checks |
requirements, data model and API, architecture, deep dives, follow-ups | what is probed, how to structure the answer, an outline to fill in |
Roles: RS research scientist · RE research engineer · MLE machine-learning engineer · SWE software engineer · Infra Eng infrastructure engineer · EM engineering manager.
git clone https://github.com/Schuture/OpenAI-Interview-Notes.git
cd OpenAI-Interview-Notes
pip install -r requirements.txt # NumPy, SciPy, scikit-learn, PyTorch, Pillow
python scripts/run_snippets.py coding/gpu-credits # one page
python scripts/run_snippets.py --all # every pageA page's ```python blocks run top to bottom as one script; ```py blocks are illustrative
(bare signatures, code that fails on purpose) and are not executed. CI uses Python 3.11.
Sorted by priority within each section. A dash under Difficulty means it has not been rated.
| # | Problem | Priority | Difficulty | Roles | Topics |
|---|---|---|---|---|---|
| 1 | Infection Spread (Grid Cellular Automaton) | ★★★★★ | Medium | SWE · MLE · RE · RS · EM | bfs, simulation, grid |
| 2 | Follow Graph & Recommendations (Social Network) | ★★★★★ | Medium | SWE · RE | graph, hashmap, snapshot, binary-search |
| 3 | Cluster Node Count & Topology (Tree Messaging) | ★★★★☆ | Medium | SWE | tree, message-passing, distributed-systems, idempotency |
| 4 | GPU Credits | ★★★★☆ | Medium | SWE | data-structure, simulation, heap |
| 5 | Prefix Matmul: Autograd, Manual Backward, Hillis–Steele Scan | ★★★★☆ | Hard | RS · RE · MLE | autograd, linear-algebra, parallel-scan, pytorch |
| 6 | NumPy 1-NN as an Affine Layer | ★★★★☆ | Medium | MLE · RE | numpy, vectorization, broadcasting, linear-algebra |
| 7 | Monster Battle | ★★★★☆ | Medium | SWE | oop-design, simulation |
| 8 | Transformer Bug Hunt | ★★★★☆ | Medium | MLE · RS · RE | transformer, debugging, kv-cache, pytorch |
| 9 | Memory Allocator | ★★★★☆ | Hard | SWE · MLE · RE | data-structure, intervals, balanced-bst |
| 10 | Noisy Annotators | ★★★★☆ | Medium | MLE · RS · RE | data-cleaning, label-noise, evaluation, numpy |
| 11 | Type Inference for a Toy Language | ★★★★☆ | Medium | SWE · RE | recursion, unification, tree |
| 12 | Data Labeling Task Scheduler | ★★★★☆ | Medium | SWE · RE · MLE | scheduling, greedy, fairness |
| 13 | Durable KV Store: Custom Serialization | ★★★☆☆ | Medium | SWE · Infra Eng | serialization, persistence, parsing, storage, fault-tolerance |
| 14 | Streaming Entropy | ★★★☆☆ | Medium | RS · RE · MLE | numerical-stability, softmax, streaming |
| 15 | Chat Bot Refactoring | ★★★☆☆ | Medium | SWE | refactoring, oop-design, event-driven, testing |
| 16 | IPv4 / CIDR Iterator | ★★★☆☆ | Medium | SWE | bit-manipulation, iterator, string |
| 17 | Shard Rebalancing with an Overlap Limit | ★★★☆☆ | Medium | SWE | intervals, greedy, heap, consistent-hashing |
| 18 | Restart Strategies under a Known Mean (Las Vegas) | ★★★☆☆ | Hard | RS · RE | probability, inequalities, algorithm-design |
| 19 | Version Dependency | ★★★☆☆ | Medium | SWE · RE | binary-search, backtracking, topological-sort |
| 20 | Sliding-Window Event Aggregation | ★★★☆☆ | Medium | SWE · Infra Eng | sliding-window, streaming, hashmap, heap |
| 21 | Three-Card Hands and Folding | ★★★☆☆ | Medium | SWE | simulation, sorting, rules-engine |
| 22 | Text Editor: Buffer, Undo, Autocomplete | ★★★☆☆ | Medium | SWE · RE | data-structure, stack, trie, collaboration |
| 23 | Fault-Tolerant Work Queue | ★☆☆☆☆ | Medium | Infra Eng | queue, state-machine, retry |
| 24 | Cross-Entropy Loss from Scratch | ★☆☆☆☆ | Medium | MLE · RE | numpy, numerical-stability, loss-functions, kl-divergence |
| 25 | Best Grid Path with K Row Skips | ★☆☆☆☆ | Hard | SWE | dp, grid, counting |
| 26 | cd Command / Path Resolution | ★☆☆☆☆ | Medium | SWE | string-processing, stack, symlinks |
| 27 | Spreadsheet with Cell Dependencies (OpenSheet) | ★☆☆☆☆ | Medium | SWE | graph, dfs, topological-sort, recursion |
| 28 | ModalLock and FairModalLock | ★☆☆☆☆ | Hard | SWE · MLE | concurrency, threading, fairness |
| 29 | Sharded Matmul: Forward, Backward, Bug Hunt | ★☆☆☆☆ | Hard | MLE · RE | linear-algebra, parallelism, autograd, numpy, pytorch, debugging |
| 30 | Resumable Iterators (1D, 2D, Arbitrary Depth) | ★☆☆☆☆ | Medium | SWE | iterator, oop-design, state |
| 31 | PyTorch Code Reading & Extension | ★☆☆☆☆ | — | RE · MLE | code-reading, pytorch, complexity |
| 32 | In-Memory SQL-like Database | ★☆☆☆☆ | Medium | SWE | data-structure, oop-design, sql |
| 33 | Time-Travel Key-Value Store | ★☆☆☆☆ | Medium | SWE | binary-search, testing, concurrency |
| 34 | Lighthouse Beams and Heavy Tails | ★☆☆☆☆ | Hard | RS · RE | probability, heavy-tails, simulation, estimation |
| 35 | RL Training Loop Bug Hunt | ★☆☆☆☆ | Hard | RS · RE · MLE | reinforcement-learning, policy-gradient, debugging, pytorch |
| 36 | Rate Limiter Bug Hunt | ★☆☆☆☆ | Medium | SWE · Infra Eng | debugging, concurrency, sliding-window, testing |
| 37 | Scheduling Agent Tool Calls with Dependencies | ★☆☆☆☆ | Medium | SWE · RE · Infra Eng | scheduling, dag, simulation, concurrency |
| 38 | Binary Search with Delayed Answers | ★☆☆☆☆ | Medium | SWE · RE | binary-search, interaction, algorithm-design |
| # | Problem | Priority | Difficulty | Roles | Topics |
|---|---|---|---|---|---|
| 1 | Payment System / Coffee-Shop Ordering | ★★★★★ | Medium | SWE | payment, idempotency, ledger |
| 2 | Online Chess Platform (Chess.com-style) | ★★★★★ | — | SWE · Infra Eng | websocket, matchmaking, game-state, idempotency, consistent-hashing |
| 3 | Video Generation Pipeline (Sora-style) | ★★★★★ | Medium | SWE · Infra Eng · EM | gpu-scheduling, queueing, fault-tolerance |
| 4 | LLM Inference Serving | ★★★★☆ | — | SWE · Infra Eng · MLE | gpu-scheduling, batching, streaming, rate-limiting, cost |
| 5 | Cloud IDE | ★★★☆☆ | Hard | SWE · Infra Eng · EM | sandbox, vm-lifecycle, websocket, streaming |
| 6 | Device Fleet Monitoring and Command Dispatch | ★★★☆☆ | — | SWE · Infra Eng | iot, messaging, idempotency, reconciliation, telemetry |
| 7 | Image Sharing with Deduplication | ★★☆☆☆ | Medium | SWE | storage, deduplication, consistency |
| 8 | Distributed Crossword Solver | ★★☆☆☆ | — | SWE · Infra Eng | distributed-search, backtracking, job-system |
| 9 | AI Chatbot Front End | ★★☆☆☆ | — | SWE | frontend, streaming, client-state, auth |
| 10 | Multi-Tenant CI/CD | ★★☆☆☆ | — | SWE · Infra Eng | scheduling, exactly-once, multi-tenancy |
| 11 | Slack-style Messaging | ★★☆☆☆ | — | SWE · EM | messaging, pubsub, multi-device, multi-tenancy |
| 12 | Search & RAG ML Design (spoken) | ★★☆☆☆ | — | RE · MLE | retrieval, contrastive-learning, ranking, evaluation |
| 13 | Calendar (Google Calendar-style) | ★★☆☆☆ | — | SWE | schema-design, caching, sync |
| 14 | URL Shortener | ★★☆☆☆ | — | SWE | hashing, caching, scaling, database |
| 15 | Webhook Delivery | ★★☆☆☆ | — | SWE · Infra Eng | queueing, retry, idempotency, security |
| 16 | Nearby Places (POI / Yelp-style) | ★★☆☆☆ | — | SWE | geospatial-index, sharding, caching |
| 17 | Streaming AI Product Feature | ★☆☆☆☆ | — | SWE | streaming, api-design, rate-limiting, fullstack |
| 18 | Novel-Data Mining from an Unlabeled Corpus | ★☆☆☆☆ | — | MLE | ml-system-design, data-mining, retrieval |
| 19 | ChatGPT Enterprise: RAG over Company Data | ★☆☆☆☆ | — | MLE · RE | rag, retrieval, access-control |
| 20 | GPT-3 Playground (Full-Stack) | ★☆☆☆☆ | — | SWE | fullstack, frontend, streaming, schema-design |
| 21 | Agent Harness and Evaluation Framework | ★☆☆☆☆ | — | RE · MLE · RS | agent, evaluation, tooling, observability |
| # | Problem | Priority | Difficulty | Roles | Topics |
|---|---|---|---|---|---|
| 1 | Hiring Manager Round: Why OpenAI, Safety, AGI | ★★★★★ | — | All | behavioral, why-company, ai-safety, cross-functional |
| 2 | Technical Deep Dive (with slides) | ★★★★★ | — | SWE · MLE · RE · Infra Eng | presentation, project-deep-dive |
| 3 | Recruiter / HR Screen | ★★★★☆ | — | All | behavioral, process, compensation, ai-safety |
| 4 | Engineering Management Round | ★☆☆☆☆ | — | EM | leadership, hiring, mentorship, performance-management, team-composition |
Corrections, new variants and translations are welcome. Found a wrong answer, a missing edge case or a sentence that does not make sense? Open an issue. For pull requests, see CONTRIBUTING.md.
The text (prose, tables and diagrams) is licensed under CC BY-NC 4.0; the code, both in the pages and
under scripts/, under the MIT License.