# loopprep > Coding interview prep for the AI labs. Each question is a small system you build step by step: pass Step 1's tests and Step 2 unlocks with follow-up requirements on the code you already wrote. You are measured on how far you get and where you stall, not on one pass or fail. > 42 of 44 questions are reported at OpenAI, Anthropic, Perplexity, Scale AI, xAI, and Cursor. > 44 questions in Python, TypeScript, and Java, timed, running entirely in your browser. Premium is $19/month and unlocks 41 questions; Transactional Key-Value Store, Profiler Stack Samples, and Worker Mode Tracker are free. ## Key pages - [Home](https://loopprep.dev/): the full question bank and pricing. - [Coding interview prep for AI labs](https://loopprep.dev/prep/ai-labs/): Multi-step AI-lab interview prep: build a small system, then keep extending it while the old tests still pass. Questions reported at Anthropic, OpenAI, and other AI labs. - [Anthropic coding interview prep](https://loopprep.dev/prep/anthropic/): Anthropic coding interview prep: multi-step questions reported at Anthropic, where follow-ups build on code you already wrote. - [OpenAI coding interview prep](https://loopprep.dev/prep/openai/): OpenAI coding interview prep: multi-step questions reported at OpenAI, where follow-ups build on code you already wrote. - [Perplexity coding interview prep](https://loopprep.dev/prep/perplexity/): Perplexity coding interview prep: multi-step questions reported at Perplexity. - [xAI coding interview prep](https://loopprep.dev/prep/xai/): xAI coding interview prep: multi-step questions reported at xAI. - [Scale AI coding interview prep](https://loopprep.dev/prep/scale-ai/): Scale AI coding interview prep: multi-step questions reported at Scale AI. - [Cursor coding interview prep](https://loopprep.dev/prep/cursor/): Cursor coding interview prep: multi-step questions reported at Cursor. - [LoopPrep by the numbers](https://loopprep.dev/stats/): the bank counted — questions, steps, and test cases per lab. - [Pricing](https://loopprep.dev/pricing.md): plans and prices in plain text, for agents. - [Question catalog (JSON)](https://loopprep.dev/api/catalog): the whole bank as JSON - titles, companies, difficulty, time, languages. ## Questions - [Transactional Key-Value Store](https://loopprep.dev/questions/kv-store/): Reported at Anthropic, OpenAI, and xAI. Python, TypeScript, and Java. Hard, 45 min. Grow a plain dictionary into a store with value counts, expiring keys, nested transactions and atomic conditional batches. Free. - [Profiler Stack Samples](https://loopprep.dev/questions/stack-samples/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 50 min. A sampling profiler hands you periodic call-stack snapshots. Turn them into trace events, then into call records, a total/self time profile, a merged call tree, and finally folded flamegraph output that survives sampling gaps. Free. - [Worker Mode Tracker](https://loopprep.dev/questions/worker-frequency/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 50 min. A coordinator collects integers from worker shards and answers global frequency queries. Start with counting, add removal and top-k, then make the hot query O(1) and let the worker pool grow. Free. - [Rate Limiter](https://loopprep.dev/questions/rate-limiter/): Reported at Anthropic and OpenAI. Python, TypeScript, and Java. Hard, 45 min. Build the rate limiting layer of an API gateway, one policy at a time: fixed window, exact sliding window, token bucket, then per-tier limits with quotas and eviction. Premium. - [Duplicate File Finder](https://loopprep.dev/questions/duplicate-files/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 50 min. Walk a directory tree and group files with identical contents, then make it safe for huge files, correct around symlinks, useful as a report, and configurable with ignore rules. Premium. - [Image Transform Pipeline](https://loopprep.dev/questions/image-pipeline/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 50 min. Run every source image through every JSON-described transformation pipeline. Build the transform engine, the directory plumbing, the cross product, then the edge cases and the decode-once optimisation. Premium. - [Persistent LRU Cache](https://loopprep.dev/questions/persistent-lru/): Reported at Anthropic and xAI. Python, TypeScript, and Java. Hard, 50 min. Build an LRU cache, expose its recency order, then make it survive a restart: snapshot and restore in memory, save and load from disk, and resize a live cache. Premium. - [Greedy Tokenizer](https://loopprep.dev/questions/greedy-tokenizer/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 45 min. Scan text left to right emitting the longest matching vocabulary entry. Then expose the segmentation, make matching independent of vocabulary size, decode back to text, and collapse runs of unknown characters. Premium. - [GPU Credit Calculator](https://loopprep.dev/questions/gpu-credits/): Reported at OpenAI and Perplexity. Python, TypeScript, and Java. Hard, 50 min. Track GPU credit grants that are added over time, partially spent, and expire. Then keep balance queries fast as grants pile up, and report what is about to expire. Premium. - [Infection After K Rounds](https://loopprep.dev/questions/infection-grid/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 45 min. Spread an infection across a grid for exactly k rounds, then compute when each cell falls, how long until things settle, and make it all independent of k. Premium. - [Spreadsheet with Cells](https://loopprep.dev/questions/spreadsheet/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 50 min. Cells hold a literal or the sum of two other cells. Evaluate them, refuse to loop on cycles, propagate updates, then cache values and invalidate only what an edit actually affects. Premium. - [Resumable Iterator](https://loopprep.dev/questions/resumable-iterator/): Reported at OpenAI and xAI. Python, TypeScript, and Java. Hard, 50 min. Iterate a sequence delivered in chunks, then make the position saveable: skip ahead, pull chunks only when needed, reject state that no longer fits the data, and merge several checkpointed streams into one. Premium. - [In-Memory Record Store](https://loopprep.dev/questions/record-query/): Reported at Anthropic and OpenAI. Python, TypeScript, and Java. Hard, 50 min. Store schemaless records and answer a small SQL-like read query over them: equality filters, the full comparison set, ordering with missing fields, projection and paging, and finally an index so the hot predicate stops scanning. Premium. - [Team Battle Simulator](https://loopprep.dev/questions/battle-sim/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 50 min. Simulate two teams fighting one-on-one down the bench, then add elemental damage modifiers, deadlock detection, speed-based initiative, and a round-robin tournament that ranks every team. Premium. - [Cluster Topology Queries](https://loopprep.dev/questions/cluster-topology/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 50 min. A cluster of machines arranged as a tree, driven by a string command interface: render the topology, measure depth and subtree size, answer ancestry questions, rewire live nodes, and keep every query fast at 20,000 machines. Premium. - [Workflow Execution Plan](https://loopprep.dev/questions/workflow-stages/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 50 min. Turn a CI workflow into an execution plan: group jobs into parallel stages, report the ones that can never run, prune to a single target, respect a worker limit, and find the critical path that sets the total runtime. Premium. - [Durable Key-Value Store](https://loopprep.dev/questions/durable-kv/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 50 min. Start from a key-value store that serializes to JSON, then give it the machinery that makes persistence real: an append-only journal, checkpoints, log compaction, and recovery from a log whose tail was lost mid-write. Premium. - [Social Graph Snapshots](https://loopprep.dev/questions/social-snapshots/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 50 min. A directed follow graph that can be photographed at any moment: snapshots that stay correct as the graph moves, cheap enough to take thousands of, then diffed, mined for recommendations, and rewound. Premium. - [Bank Ledger](https://loopprep.dev/questions/bank-ledger/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 50 min. A ledger for a payments backend: accounts and deposits, transfers that cannot overdraw, a ranking of who moves the most money, payments that refund cashback a day later, and the balance any account held at any past moment. Premium. - [Same-Host Web Crawler](https://loopprep.dev/questions/web-crawler/): Reported at Anthropic and OpenAI. Python, TypeScript, and Java. Hard, 50 min. Crawl a site through a link provider that costs something every time you call it: collect the reachable pages, respect a page budget and a depth limit, survive a flaky provider, and answer shortest-path questions without fetching the whole site. Premium. - [Task Tracker](https://loopprep.dev/questions/task-tracker/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 50 min. The read side of an issue tracker: tasks with priorities, prefix search ranked the way a human expects, assignment and completion rules, an overdue report, and an index so the search box stays instant at twenty thousand tasks. Premium. - [Recipe Catalog](https://loopprep.dev/questions/recipe-catalog/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 45 min. A recipe box with opinions: store and look up recipes, query by ingredient and by cooking time, rank them by rating, then answer the only question that matters on a weeknight — what can I make right now with the fewest ingredients left over. Premium. - [JSON Path Query](https://loopprep.dev/questions/json-path/): Python, TypeScript, and Java. Hard, 45 min. The query language every config tool ends up growing: read a value out of nested JSON by dot path, match many at once with wildcards, index into arrays, report where each match came from, and finally write values back. Premium. - [Latency Tracker](https://loopprep.dev/questions/latency-tracker/): Python, TypeScript, and Java. Hard, 50 min. The p99 panel every service dashboard has: record latencies as they arrive, answer percentile queries without re-sorting, restrict them to a time window, ask the inverse question, and merge the trackers of every shard into one. Premium. - [Agent Task Graph](https://loopprep.dev/questions/agent-task-graph/): Reported at Perplexity. Python, TypeScript, and Java. Hard, 48 min. The to-do list an AI agent works through, where every task waits on others: track what is ready, let one failure block everything downstream, retry within a budget, recover when the root cause is fixed, and stay fast at twenty thousand tasks. Premium. - [Card Game Engine](https://loopprep.dev/questions/card-game/): Reported at Scale AI. Python, TypeScript, and Java. Hard, 47 min. The rules engine behind a shedding card game, written while the rules keep changing: match by color or rank, then add skips, reverses and penalties, wild cards with a declared color, a house rule switched on mid-game, and scoring across a whole match. Premium. - [Snapshot Diff](https://loopprep.dev/questions/snapshot-diff/): Reported at Cursor. Python, TypeScript, and Java. Hard, 48 min. Hash a repository snapshot into a Merkle tree, then use it the way an editor does: find the files that changed between two snapshots without reading the ones that did not, rehash only what a write touched, and spot a rename instead of reporting a delete and an add. Premium. - [Path Resolver](https://loopprep.dev/questions/path-resolver/): Reported at OpenAI and Perplexity. Python, TypeScript, and Java. Hard, 48 min. Build the in-memory file system a sandboxed agent works in, then the path resolver underneath it: cd with . and .., relative and home paths, symbolic links that resolve the way a kernel does, and a loop check that tells a cycle from a long chain. Premium. - [Agent Loop](https://loopprep.dev/questions/agent-loop/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 48 min. Write the loop at the center of every tool-using agent: send the conversation to a model, run the tools it asks for, feed back the results and the errors, stop it gracefully when it runs out of steps, and handle several calls in one turn without running the same one twice. Premium. - [Cloud Storage](https://loopprep.dev/questions/cloud-storage/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 48 min. Build the bookkeeping behind a cloud file store as the spec grows: files and sizes, the largest files under a prefix, users with quotas who can merge accounts, backup and restore, and the size any file had at any point in its history. Premium. - [Provider Pool](https://loopprep.dev/questions/provider-pool/): Reported at Perplexity. Python, TypeScript, and Java. Hard, 48 min. Route requests across a pool of LLM providers the way an answer engine has to: fail over when one errors, never retry a bad request, respect each provider’s rate limit, prefer the cheapest within a budget, and stop calling a provider that keeps failing until it has had time to recover. Premium. - [Memory Allocator](https://loopprep.dev/questions/memory-allocator/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 48 min. Hand out blocks of one contiguous region the way malloc does: first fit, free with coalescing, realloc that grows in place when it can, best fit to fight fragmentation, compaction, and a free-space index that stays fast with thousands of holes. Premium. - [IPv4 Iterator](https://loopprep.dev/questions/ipv4-iterator/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 48 min. Walk IPv4 address space lazily, the way an allowlist or a scanner has to: ranges in either direction, CIDR blocks up to all four billion addresses, the smallest set of blocks that covers a range, and exclusions you jump over instead of stepping through. Premium. - [Load Balancer](https://loopprep.dev/questions/load-balancer/): Reported at Scale AI. Python, TypeScript, and Java. Hard, 48 min. The dispatcher in front of a pool of workers: queue tasks, hand them to the worker with the most room, respect priorities and capacities, notice when a worker goes silent and requeue its work, and stay fast at twenty thousand workers. Premium. - [Durable Work Queue](https://loopprep.dev/questions/work-queue/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 48 min. The work queue behind a task system: hand tasks out in order, fence each reservation with a token, retry within a budget, expire leases that go silent, hold tasks behind their dependencies, and stay fast at twenty thousand tasks. Premium. - [Task Processor](https://loopprep.dev/questions/task-processor/): Reported at Scale AI. Python, TypeScript, and Java. Hard, 47 min. The deadline-ordered task queue from the Scale AI phone screen: hand out the most urgent task first, hold parents behind their subtasks, move deadlines, reject cycles, and stay fast at twenty thousand tasks. Premium. - [CSV Classifier](https://loopprep.dev/questions/csv-classifier/): Reported at Scale AI. Python, TypeScript, and Java. Hard, 47 min. The data-labeling pipeline behind an LLM eval: read rows out of a CSV file, turn them into typed records, classify each one with a classifier, and keep the pipeline honest when the classifier misbehaves, then make it fast at twenty thousand rows. Premium. - [Beam Search Decoding](https://loopprep.dev/questions/beam-search/): Reported at Perplexity. Python, TypeScript, and Java. Hard, 48 min. Decode text from a language model the way inference does it: start greedy, keep a beam of the best sequences, rank them with a length penalty, block repeated phrases, and stop the moment no unfinished beam can win. Premium. - [Toy Language Type Inference](https://loopprep.dev/questions/type-inference/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 48 min. The type checker for a toy language: build types as trees, print them, infer the return type of a call by binding its generics, and keep it working on types nested twenty thousand deep. Premium. - [Stop-Sequence Truncation](https://loopprep.dev/questions/stop-sequence/): Reported at Perplexity. Python, TypeScript, and Java. Hard, 48 min. Cut generated text at the first stop sequence, then do it on a stream you cannot store: catch stops split across chunks, say which stop matched, and stay fast with twenty thousand stops. Premium. - [ChatBox Service](https://loopprep.dev/questions/chat-box/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 47 min. The messaging service from the ChatBox assessment: channels and direct messages, then history queries, expiring messages with notifications and per-user filters, then history that stays fast as the box grows. Premium. - [Data Labeling Scheduler](https://loopprep.dev/questions/data-labeling-scheduler/): Reported at OpenAI. Python, TypeScript, and Java. Hard, 47 min. Build a scheduler that hands labeling work to humans and models: cover every task, balance the models, balance each human, and stay fast at a hundred thousand assignments. Premium. - [Weighted Data Batcher](https://loopprep.dev/questions/data-batcher/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 48 min. The mixer that feeds training: blend examples from several datasets in proportion to their weights, keep the mix exact across batches, resume from a checkpoint, and never pull an item twice. Premium. - [Workforce Time and Pay](https://loopprep.dev/questions/workforce-pay/): Reported at Anthropic. Python, TypeScript, and Java. Hard, 48 min. Clock employees in and out, rank them by hours worked, reprice a session with a deferred promotion, pay each session at its own rate inside any window, and double pay without ever paying four times. Premium. ## Optional - [Full question catalog](https://loopprep.dev/llms-full.txt): every question with its facts and step outline, in plain text.