practice a little every day — you've got this ♡
Data Structure Design Interview Problems
Practice 5967 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.
- 5967
- Problems
- 2210
- Auto-graded
- 15
- Topics
- 272
- Added today
Showing 1–30 of 362 results
- Data Structure DesignMediumModel answerDeadlock-Free Atomic Funds Movement Between Shared Accounts
Design a concurrent transfer operation over an in-memory account store that never loses updates, is all-or-nothing, preserves total money, and cannot deadlock.
Data Structure Designconcurrencylockingdeadlockatomicity - Data Structure DesignMediumModel answerPython ABCs and the Three Kinds of Methods Explained
Explain how abstract base classes work in Python and how instance, class and static methods differ in binding, inheritance behavior and typical use.
Data Structure Designpythonoopabstract-classesclassmethod - Data Structure DesignMediumModel answerHandling Seekable Body Replays on 307 Redirects in Python requests
Debug and implement stateful body rewind logic for seekable file-like streams when executing HTTP 307 redirects in an HTTP client library.
Data Structure Designpythonhttpdebuggingstreams - Data Structure DesignMediumModel answerDesign a Blackjack Game Engine
Architect an object-oriented Blackjack engine handling multi-deck shoes, split hands, and soft/hard total calculations.
Data Structure DesignData Structure DesignObject-Oriented DesignState Machine - Data Structure DesignMediumModel answerBuild a Batch Grayscale Thumbnailer with Worker Pools
Design and code a Pillow-based batch tool that grayscales and shrinks images, then scale it to many large files with multiprocessing, robust error handling, bounded memory and benchmarks.
Data Structure Designpythonpillowmultiprocessingconcurrency - Data Structure DesignHardModel answerBuild a Thread-Safe Dual-Resource Allocator
Design a concurrency controller that manages exclusive access to two distinct targets while preventing deadlocks and invalid release calls.
Data Structure Designconcurrencymultithreadinglockssynchronization - Data Structure DesignMediumModel answerDebugging a LinkedHashMap-Based Eviction Cache in Java
Review a Java cache built on LinkedHashMap that evicts the wrong entries, find each defect, write minimal failing tests, and produce a corrected version.
Data Structure Designlru-cachejavalinkedhashmapdebugging - Data Structure DesignMediumModel answerAudited Lazy File Streaming with Generators, Decorators and with
Build a decorator that audits a chunked file-reading generator's lifecycle, with deterministic file cleanup on completion, early exit, errors and garbage collection.
Data Structure Designpythongeneratorsdecoratorscontext-managers - Data Structure DesignMediumModel answerMaking a Memoizing Python Function Safe for Many Threads
Critique a Python function that caches expensive results in a dict, then make it thread-safe so each input is computed once, without blocking cache hits or unrelated inputs.
Data Structure Designpythonconcurrencycachinglocking - Data Structure DesignMediumModel answerVersioned Follow Graph with Time-Travel Queries and Suggestions
Build an in-memory directed follow graph with cheap snapshots, historical edge lookups, and a friends-of-friends suggestion ranking with id tie-breaks.
Data Structure Designgraphsnapshotsbinary-searchheap - Data Structure DesignMediumModel answerLive Scoreboard Engine for One Tennis Game
Process a sequence of point winners for a single tennis game and print the correct score after each point, including deuce, advantage and the win-by-two rule.
Data Structure Designsimulationstate-designclass-designedge-cases - Data Structure DesignMediumModel answerSnapshot and Restore for an In-Memory String Map
Build an in-memory string map in C++ that can dump its full state to a byte buffer and rebuild it, handling arbitrary bytes, corrupt input, and failed restores safely.
Data Structure Designserializationbinary-formathash-mapinput-validation - Data Structure DesignMediumModel answerThread-Safe Ledger for Courier Payouts and Client Invoices
Design an in-memory, thread-safe ledger that upserts delivery records and serves instant per-courier earnings and per-client invoice totals in integer cents.
Data Structure Designconcurrencyhash-mapincremental-aggregationlow-level-design - Data Structure DesignMediumModel answerDesign a Custom CSV Parsing and Filtering Engine
Implement an in-memory CSV query processor with auto-type inference and polymorphic field filtering.
Data Structure Designparsingdesign-dsstringsarrays - Data Structure DesignMediumModel answerTurn-Based Squad Combat Engine with Deterministic Ordering
Simulate a fight between two squads of monsters with fixed turn order, weakest-first targeting and a damage formula, and return the ordered list of attack events.
Data Structure Designsimulationobject-oriented-designsortingtie-breaking - Data Structure DesignHardModel answerThread-Safe In-Memory Store and Sliding-Window Counter
Find the concurrency bugs in an in-memory key-value store with expiry and a 300-second hit counter, then fix them with appropriate locking and describe how to test.
Data Structure Designconcurrencyrace-conditionslockingthread-safety - Data Structure DesignMediumModel answerBuild a Grouped, Promo-Aware, Sorted Receipt Printer
Extend a cart class that turns scanned item names into a receipt: itemized total, grouping by type, a buy-three-get-two-free deal, then alphabetical ordering.
Data Structure Designobject-oriented-designhash-maprefactoringmoney-arithmetic - Data Structure DesignMediumModel answerLayered REST API for Text Condensing with FastAPI
Design a small FastAPI service that accepts text, returns a placeholder-generated summary, validates input, handles errors, and keeps a bounded in-memory history, using clear layers.
Data Structure Designfastapipythonpydanticrest-api - Data Structure DesignEasyModel answerResolving Name Clashes Across Two Python Parent Classes
Predict which inherited method runs when a class has two parents defining the same method name, and explain Python's lookup order, super() cooperation, and alternatives.
Data Structure Designpythoninheritancemroc3-linearization - Data Structure DesignMediumModel answerDesign an Audio Player Core with Queue Management and Shuffle Logic
Architect the object-oriented structure and state machine for a media player featuring play/pause controls, queue prioritization, looping modes, and deterministic shuffle handling.
Data Structure DesignObject-Oriented DesignState MachineData Structure Design - Data Structure DesignMediumModel answerBuild a Playing-Card Deck with Fair Shuffle and Custom Sort
Model a 52-card deck, return an unbiased random permutation, and list the cards in a defined rank-then-suit order, with data structures and complexity explained.
Data Structure Designobject-oriented-designshufflefisher-yatessorting - Data Structure DesignEasyModel answerFleet Command Console for Grid-Walking Robots
Design a text-driven controller that manages several robots on an unbounded grid, handling turns, steps, selection, error cases and cell collisions.
Data Structure Designsimulationhash-mapcommand-parsingstate-machine - Data Structure DesignMediumModel answerBuild a Weighted Hash Ring for Sharding Keys Across Servers
Design a hash ring with weighted virtual nodes that assigns keys to servers, supports adding and removing servers with little key movement, and handles collisions and concurrency.
Data Structure Designconsistent-hashingvirtual-nodesbinary-searchthread-safety - Data Structure DesignMediumModel answerFunction Composition Twice and Core Container Cost Comparison
Write a helper that feeds a function's output back into itself, explain closures and side effects, then compare arrays, linked lists, stacks and queues by operation cost.
Data Structure Designhigher-order-functionsclosuresside-effectscomplexity-analysis - Data Structure DesignMediumModel answerBuild a Fire-Once Event Gate for Concurrent Threads
Design a thread-safe one-shot event gate with fire, timed wait and non-blocking status check, avoiding lost wakeups, spurious-wakeup bugs and busy-waiting.
Data Structure Designconcurrencycondition-variablethreadingsynchronization - Data Structure DesignMediumModel answerWeighted Random Picker with Live Weight Updates
Build a container that returns items at random with probability proportional to their weights, supports re-weighting existing items, and keeps picks fast and memory small.
Data Structure Designfenwick-treeprefix-sumsrandom-samplingbinary-search - Data Structure DesignMediumModel answerBuild a Wildcard-Aware URL Router with Literal Priority
Design a router that stores path templates with {name} wildcards and resolves concrete paths to a handler plus captured values, preferring exact segments and backtracking when they dead-end.
Data Structure Designtriebacktrackingroutingstring-parsing - Data Structure DesignHardModel answerIn-Memory Bank With Delayed Payments, Cancellation and Spend Ranking
Extend an in-memory bank with delayed payments that can be canceled, record success or failure for each, discard stale entries, and rank accounts by total outgoing money.
Data Structure Designdesign-dsheaplazy-deletionsimulation - Data Structure DesignMediumModel answerUpgrade a Streaming Log Filter to Multi-Code and JSON Output
Refactor a small Python log-counting script so it filters on several status codes, optionally writes JSON, streams multi-gigabyte files in constant memory, and stays unit-testable.
Data Structure Designpythonrefactoringstreamingcli - Data Structure DesignMediumModel answerBuild a Heap Allocator with Fit Policies and Safe Handles
Design a simulated memory manager over a fixed address range that supports two placement policies, splitting, merging of neighbors, and rejection of stale or forged release requests.
Data Structure Designmemory-allocatorlinked-listhash-mapcoalescing