Free beta: free to use with daily limits while we build. Join the waitlist for founding-member pricing at launch. Join the waitlist

Sign up free

OpenAI interview question

Build a durable key-value store and split its data files by a size limit

Company:
OpenAI
Type:
Coding
Difficulty:
Hard
Reported:
November 18, 2026

Problem

Implement a durable key-value store with set(key, value) and get(key) for string keys and values. Durable means that once set returns, the data survives the process stopping or crashing: when the store is opened again on the same directory, every acknowledged write is readable.

Follow-up: split the stored data into multiple files based on a size limit.

Other operations (such as delete), the on-disk format, and what to do with a single record larger than the limit are not specified; clarify them with the interviewer.

Example 1

Input: open(dir); set("a", "1"); set("b", "two"); set("a", "3"); close(); open(dir); get("a"); get("b"); get("c")
Output: "3", "two", None

Values written before the restart are recovered, the latest write wins, and a missing key returns None.

Example 2

Input: open(dir, max_file_size=64); set 20 keys whose records are 25 bytes each
Output: several data files, each at most 64 bytes

When the next record would push the current file over the limit, writing continues in a new file.

Constraints

  • Not stated; ask the interviewer.

Reported by candidates or drawn from publicly available sources, and rewritten in our own words. Pathwise Prep does not publish confidential assessment content. Report a concern