OpenAI onsite coding interview

Round 4 of 7 · 36 questions reported

See the whole loop
Length
60 min
Format
Live coding; the problem often rebuilds a familiar system in several parts
They grade
Correct code first, then performance; test discipline; command of your language (iterators, generators, async in Python)
AI use
No AI
Heads-up
Larger in scope than the screen, and speed matters. Infra loops add a separate ML coding round on top of the systems coding round.

Questions OpenAI asks in this round 36

  • GPU credit ledger with out-of-order eventsCodingBuild an in-memory ledger for GPU credits. Credit arrives as grants: each one has a unique id, an amount, and a time window in which it can be spent. Grants may overlap in time…
    Last asked Sep 2026
  • Social follow graph with point-in-time snapshotsCodingBuild an in-memory follow graph that can answer questions about its own past. Follows are directed: a following b says nothing about b following a. Implement a SocialNetwork…
    Last asked Sep 2026
  • Count and map a cluster tree with message passingCodingA cluster of n machines is wired as a rooted tree (any number of children per node). Each machine knows only three things: its own id (a string such as "4"), its parent's id ("-1"…
    Last asked Sep 2026
  • Turn-based monster team battle simulatorCodingWrite a deterministic simulator for a turn-based battle between two ordered teams of monsters, and return the battle log and the result. python class Monster: name: str unique…
    Last asked Aug 2026
  • Data labeling scheduler with prefix-balanced modelsCodingA data labeling platform pairs tasks, AI models and human annotators. IDs are 1-indexed strings: tasks "t1"…"t{totalTask}", models "m1"…"m{totalModel}", humans…
    Last asked Jul 2026
  • Persistent key-value store with binary snapshotsCodingImplement an in-memory key-value store whose whole state can be saved to, and restored from, a storage medium that holds a single binary blob. You are given: Implement
    Last asked Oct 2026
  • Extensible chat app with command botsCodingImplement an in-memory chat app with one shared channel that people and bots post to. Users send text. Some messages are slash commands (/name arg ...), and bots can respond to…
    Last asked Oct 2026
  • Fault-tolerant work queue with leases and retriesCodingImplement an in-memory work queue that keeps working when workers crash. Workers take a task, process it, and report success or failure. A worker that dies silently must not lose…
    Last asked Oct 2026
  • IPv4 range iterator with reverse and CIDR supportCodingAn IPv4 address such as "172.16.4.9" is four octets, each 0 to 255. Taken together, the octets form one unsigned 32-bit number. Build iterators that walk IPv4 addresses lazily…
    Last asked Sep 2026
  • Earliest release that supports a featureCodingYou ship a library whose releases are listed in versions, sorted from oldest to newest. Each entry is a "MAJOR.MINOR.PATCH" string; parts are non-negative integers and may be…
    Last asked Mar 2026
  • Per-user chat event counts in a sliding windowCodingA chat service runs for months without restarting. It sends you a stream of message events. Each event has a userid, a chatid and an integer timestamp in seconds. You must answer…
    Last asked Oct 2026
  • Crash-safe on-disk key-value storeCodingBuild a filesystem-backed hash table that survives crashes and restores every entry from the latest state on restart. Reported on 1point3acres' Baseten bank; reconstructed in our…
    Last asked Sep 2026
  • Guess the number with one-call delayed feedbackCodingA hidden integer secret lies in 1, n, inclusive. You can't read it. The only way to learn about it is a comparison service with one method: The service answers one call late. Each…
    Last asked Sep 2026
  • Typed task lock for mutually exclusive job typesCodingSome jobs on a shared accelerator pool must not run alongside jobs of a different kind. Each job runs on its own thread and has one of two types: "gen" or "score". Any number of…
    Last asked Aug 2026
  • Resumable iterators that save and restore their positionCodingDefine an iterator interface that can export its state and be resumed from it later. Implement it for a flat list, then for nested multi-dimensional lists, then across several…
    Last asked Jun 2026
  • Read and refactor a large PyTorch training fileCodingYou get a few hundred lines of existing PyTorch code that trains a classifier. Answer questions about its time and memory cost, then make a series of changes to it in parts…
    Last asked Mar 2026
  • In-memory SQL table with filtering and multi-key sortingCodingBuild a small in-memory SQL-like database. You do not need to parse SQL text. Queries arrive as structured arguments. Implement SQLManager: - createtable(name: str, columns:…
    Last asked Dec 2025
  • Microorganisms eating neighbours: the largest survivorCodingMicroorganisms stand in a row. Each one has a family (a letter) and a size (a positive integer). A microorganism can eat the neighbour directly to its left or right when that…
    Last asked Oct 2026
  • Mini spreadsheet with formulas and cycle detectionCodingBuild a mini spreadsheet with cell get and set, formula evaluation over dependencies, cached values with eager updates, and cycle detection. Covers the bank's spreadsheet variants…
    Last asked Sep 2026
  • Memory allocator: leftmost free block and free by ownerCodingA memory has n units, numbered 0 to n - 1, all free at the start. Process a list of operations in order, each producing one recorded value: 1. Allocate size units for an owner:…
    Last asked Sep 2026
  • Snapshot set with frozen insertion-order iteratorsCodingImplement SnapshotSet, a set of integers whose iterators are frozen at the moment they are created. - add(value) - bool: insert value. Return False and do nothing if it is already…
    Last asked Aug 2026
  • Simulate particles from a point source hitting a screenCodingA point source sits some distance in front of an infinitely tall vertical screen and fires particles toward it. Each particle leaves at a random angle drawn uniformly between -π/2…
    Last asked Feb 2026
  • Resolve a cd command to an absolute pathCodingWrite a function that takes the current directory and the argument to cd, and returns the directory pwd would print afterwards. Handle ., .., repeated and trailing slashes, and…
    Last asked Dec 2025
  • Debug a Python job schedulerCodingYou own a small in-process job scheduler. It runs on a fake clock so it can be tested. Users report that: - a nightly report scheduled for exactly the end of a window sometimes…
    Last asked Jul 2026
  • Indexed sequence with checkpointsCodingBuild a growable array that can take cheap snapshots. The spec arrives in three parts; finish and test each part before the next. Part 1. append(value) - index, pop() - value…
    Last asked Jul 2026
  • Alert routing service with silences and escalationCodingBuild the routing core of an alerting service. The monitoring system calls fire(labels, now) for an active alert on every evaluation cycle (every 30 seconds or so) and…
  • Shuffle, deal and sort a four-player card handCodingYou are building the core of a four-player card game. Model a standard 52-card deck and implement the deal. Types to define - Suit: CLUBS, DIAMONDS, HEARTS, SPADES, in this order…