OpenAI Software Engineer Coding & Algorithms Interview Questions
Master your tech interview with our curated database of real questions from top companies.
Implement in-memory DB querying
Question Implement an in-memory database that supports: 1. Querying the whole table and returning only selected columns (projection). 2. Adding WHERE ...
Implement credit ledger with out-of-order timestamps
Problem You are implementing a GPU credit ledger that supports adding credits, charging credits, and querying balances. Requests can arrive in any tim...
Implement an in-memory SQL-like table
Problem Implement a simple in-memory database for one table. All values are strings. Each row is identified by a rowKey (string). Each row contains co...
Implement map serialization and deserialization
You are given an in-memory map (dictionary) from strings to strings. Implement two functions: - string serialize(map<string, string> m) - map<string, ...
Implement a persistent sharded key-value store
Problem Implement a simple key–value store that persists data on disk. You must store the data in fixed-size shards, where each shard is saved in one ...
Implement IPv4 iterators and CIDR expansion
Problem: IPv4 Iterators and CIDR Expansion You are implementing utilities to iterate over IPv4 addresses. An IPv4 address is in dotted-decimal form: A...
Simulate turn-based monster team battle
Design an object-oriented model and implement the core battle logic for a turn-based fight between two teams of monsters. The system should simulate t...
Design a parser for a hypothetical language
You are given a set of syntax rules for a hypothetical programming language written in BNF/EBNF. Design data structures and algorithms that: ( 1) pars...
Implement GPU credit ledger
You manage a GPU pool with per-tenant credits. Given a list/stream of events where each event adjusts a tenant’s credit balance by a signed integer (p...
Implement KV store serialization
Implement serialization and deserialization for an in‑memory key‑value store to and from a contiguous bytes buffer. Keys are UTF‑8 strings; values may...
Implement expiring credit ledger
Implement an expiring-credit ledger that supports out-of-order events. Expose three functions with the following semantics: - add_credit(id, amount, t...
Implement a Simulated Memory Allocator
Implement a simulated memory allocator that supports allocate(size) and free(ptr) operations analogous to malloc and free. Treat memory as a contiguou...
Implement compile-time function type verification
Implement a C++20 compile-time utility to verify whether a callable matches a target function type. Requirements: create a primary template is_callabl...
Design a persistent key-value store
Design and implement an in-memory key-value store with a 'medium' layer that serializes the store to bytes for persistence. Provide four functions: se...
Implement KV store and plan type conversions
Part 1 — Versioned key-value store: Implement a data structure with set(key, value, t) and get_at(key, t) that returns the value for key whose timesta...
Optimize C++ Performance with Provided Concurrency
Given a C++ codebase where threading components (threads, work queues, and synchronization primitives) are already provided, profile and optimize the ...
Implement an expiring GPU-credit manager
Implement an expiring GPU-credit manager for a cloud provider. Each user receives credit grants with an amount and an expiration timestamp. Support: (...
Implement in-memory KV store with serialization
Implement an in-memory key-value store in Python that supports setting and retrieving values and can serialize and deserialize the entire store. Defin...
Implement a GPU credit manager
Implement a GPU credit manager for a compute cluster. Each user has a nonnegative credit balance that can be increased (grantCredits(user, amount)), c...
Manage GPU Credits with Expiration
Question Implement a GPU credit manager supporting out-of-order operations: API add_credit(id, amount, timestamp, expiration) // adds ‘amount’ credit...