Openai Interview Questions
Practice the exact questions companies are asking right now.
Explain KV cache in Transformer inference
Question In Transformer-based language model inference, what is a key-value (KV) cache? Explain: - What gets cached (tensors, shapes at a high level) ...
Design a RAG system with evaluation
Scenario You are asked to design a Retrieval-Augmented Generation (RAG) system that answers user questions using a private corpus (e.g., internal docs...
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 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 toy-language types and generic substitution
Problem: Toy Language Type System (Printing + Generic Resolution) You are implementing a small type system for a custom “Toy Language”. Types can be: ...
Design a payment processing system
Scenario Design a backend payment system for an online product that supports: - One-time charges and refunds. - Idempotent payment APIs (clients may r...
Design a CI/CD system with live log streaming
System Design Prompt: CI/CD Platform (shell-script jobs) Design a CI/CD system that can: 1. Allow users to define pipelines consisting of multiple job...
How would you build an image classifier with dirty data?
Scenario You are asked to build an image classification model (single-label, multi-class) for a product team. The image dataset is known to be dirty (...
Compute time to infect all cells
You are given an n × m grid representing people in a city. - Each cell is either infected (1) or healthy (0). - Two cells are neighbors if they share ...
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, ...
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 social network with snapshots
You are asked to design and implement an in-memory SocialNetwork class that supports users following each other and creating snapshots of the follow g...
Design a CI/CD system with stuck-job handling
Scenario Design a CI/CD platform similar to GitHub Actions/Jenkins that: - Triggers pipelines on events (e.g., push/PR/merge). - Runs pipelines as a D...
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 ...
Design a search query autocomplete system
Question Design a search autocomplete system that suggests completions as the user types. Requirements - Sub-100ms latency per keystroke. - Suggestion...
Debug and fix a PyTorch Transformer training loop
Minimal Causal LM Debugging and Optimization Context You are given a tiny causal decoder-only language model implemented in PyTorch. It appears to "tr...
Design a URL shortening service
Design a scalable backend service for shortening URLs (similar to popular URL shortener products). Describe a system that supports at least the follow...
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...
Design GPU credit allocator
System Design: GPU Credits Allocation and Fair Usage Context You are designing a multi-tenant platform that provides access to GPU compute across many...
Design a multi-device calendar application
System design prompt Design a calendar application similar to Apple Calendar. Core features - Users can create, update, and delete events. - The UI mu...