Topic
Data Structure Design interview problems
Caches, iterators, rate limiters and custom containers. 737 original problems, each with hidden test cases you can run in the browser.
53 easy587 medium97 hard
Showing 31–60 of 737 results
Compress sparse sequences into run-length encodings, calculate their dot product, and analyze nested call timestamps using a call stack.
Auto-gradedarraysstackstwo-pointersdesign-dsProcess a sequence of timestamped operations managing workspace balances, immediate transfers, scheduled/cancelled future transfers, and ranked queries.
Auto-gradedheaps-sortingdesign-dsarraysMaintain a dynamic ordered set of numbers and, per arrival, find the smallest stored value in a closed window around it, deleting it or inserting the newcomer.
Auto-gradedordered-setbalanced-bstbinary-searchstreamingSimulate a stream join that pairs order and price events by ID, using a min-heap with lazy deletion to expire unmatched partial records.
Auto-gradedhash-mapheapsimulationstream-processingSimulate 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.
Model answersimulationobject-oriented-designsortingtie-breakingSimulate a stream of timestamped log events and answer window queries for the k most frequent messages, with ties broken alphabetically, using binary search over a sorted log.
Auto-gradeddesignbinary-searchhash-mapsortingFind 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.
Model answerconcurrencyrace-conditionslockingthread-safetySimulate a stream of up/down/clear reactions on articles, maintaining net scores and a bounded log of the three most recent reversals per article, all in constant time per operation.
Auto-gradedhash-mapdequesimulationstate-trackingExtend 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.
Model answerobject-oriented-designhash-maprefactoringmoney-arithmeticDesign 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.
Model answerfastapipythonpydanticrest-apiPredict 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.
Model answerpythoninheritancemroc3-linearizationReplay a log of increment calls and report, for each call, how many times its key has appeared so far, testing hash map counting and a simple operation-dispatch design.
Auto-gradedhash-mapsimulationdesigncountingArchitect the object-oriented structure and state machine for a media player featuring play/pause controls, queue prioritization, looping modes, and deterministic shuffle handling.
Model answerObject-Oriented DesignState MachineData Structure DesignSimulate a bounded FIFO ring buffer driven by a list of commands, handling wrap-around, full and empty states, and returning each command's result in order.
Auto-gradeddesignqueuering-buffersimulationModel 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.
Model answerobject-oriented-designshufflefisher-yatessortingSimulate an expense tracking ledger executing sequential API calls with validation and error checks.
Auto-gradeddesign-dsarrayshash-tableSimulate an in-memory key-value store with nested transactions, a global commit, and a live per-value key tally, processing a batch of operations and returning each result.
Auto-gradedhash-mapundo-logtransactionssimulationDesign a text-driven controller that manages several robots on an unbounded grid, handling turns, steps, selection, error cases and cell collisions.
Model answersimulationhash-mapcommand-parsingstate-machineSimulate a time-aware key-value store with expiry, stale entries that stay stored, and a read-through fetch whose loader outcome is given as data, with strict input validation.
Auto-gradedsimulationhash-mapcachevalidationSimulate a pixel canvas with draw, erase, flood fill, undo and redo, returning a canvas snapshot after every command while keeping the history stacks consistent.
Auto-gradedstacksimulationflood-fillundo-redoDesign 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.
Model answerconsistent-hashingvirtual-nodesbinary-searchthread-safetySimulate a set that processes add, remove, contains and snapshot operations, where each snapshot must be an independent frozen copy of the set at that moment.
Auto-gradeddesignhash-setsnapshotsimulationReplay a list of get/put operations on a bounded cache that evicts by recency or by frequency (ties broken by recency), and return the result of each operation.
Auto-gradedhash-mapordered-dictlrulfuWrite 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.
Model answerhigher-order-functionsclosuresside-effectscomplexity-analysisBuild a double-ended queue on a resizable circular array so index lookups are O(1), then replay a command list against it and report each result.
Auto-gradedcircular-bufferdequedynamic-arrayamortized-analysisSimulate add, remove, reorder and render commands on a layered character canvas, resolving overlaps by layer order and clipping shapes at the edges.
Auto-gradedsimulationordered-dictdesignclippingDeduplicate log records by event id under a first or latest policy, then replay an operation list through a watermark-based stream deduplicator that drops late data and evicts finalized entries.
Auto-gradedhash-mapsortingstreamingwatermarkDesign 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.
Model answerconcurrencycondition-variablethreadingsynchronizationBuild 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.
Model answerfenwick-treeprefix-sumsrandom-samplingbinary-searchSimulate a timestamped ledger with deposits, transfers, spends with delayed cashback, account merges and spend rankings, using union-find and a min-heap.
Auto-gradeddesignunion-findheapsimulation