OpenAI logo

OpenAI Software Engineer System Design Questions

53 practice questions for OpenAI Software Engineer interviews

OpenAI software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

All Roles Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
1
System Design
system design Hard Verified Question #1

1. Top 5 Open AI System Design Questions


Category: Trie-based system design problem
# System Design Questions - OpenAI A collection of commonly asked system design questions from OpenAI interviews.
Input: Given input
Output: Computed result
system design Hard data structure #1

1. [OA] MedianFinder — Implement a data structure for keeping OpenAI's result metrics

OpenAI often needs to compute the median of predicted metrics in real-time. This requires an efficient data structure to retrieve the median quickly while processing continuous streams of data.
### Class Definition
Class MedianFinder should implement the following methods:
- addNum(num: int) -> None: Adds a number to the data structure.
- findMedian() -> float: Returns the median of all added numbers.
### Example 1:
Input: medianFinder = MedianFinder(); medianFinder.addNum(1); medianFinder.addNum(2); medianFinder.findMedian()
Output: 1.5
Explanation: The median of [1,2] is 1.5
### Example 2:
Input: medianFinder.addNum(3); medianFinder.findMedian()
Output: 2
Explanation: The median of [1,2,3] is 2.
### Constraints:
- -10^5 <= num <= 10^5
- There will be at most 1,000,000 calls to addNum and findMedian.
system design Hard caching #2

2. [OA] LRU Cache — Design an LRU Cache for OpenAI's model predictions

OpenAI needs an efficient caching system to store previously computed model predictions, optimizing resource usage and response time.
### Class Definition
Class LRUCache should implement the following methods:
- get(key: int) -> int: Returns the value of the key if the key exists, otherwise returns -1.
- put(key: int, value: int) -> None: Updates the value of the key if the key exists existing and moves the key to the front of the cache. Otherwise, it adds the key/value pair to the cache.
### Example 1:
Input: cache = LRUCache(2); cache.put(1, 1); cache.put(2, 2); cache.get(1)
Output: 1
Explanation: Returns 1
### Example 2:
Input: cache.put(3, 3); cache.get(2)
Output: -1
Explanation: Returns -1 since the cache reached its capacity; LRU (key = 2) was evicted.
### Constraints:
- The capacity of the cache will be between 1 and 1000.
- All keys will be unique.

Related OpenAI Software Engineer interview prep

Start practicing OpenAI questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free