Topic
Data Structure Design interview problems
Caches, iterators, rate limiters and custom containers. 739 original problems, each with hidden test cases you can run in the browser.
53 easy589 medium97 hard
Showing 391–420 of 739 results
Replay a list of queue operations on a first-come waitlist, supporting add, remove-by-id, rank lookup and front peek, with rank queries faster than a linear scan.
Auto-gradeddesignorder-statistictreaphash-mapRedesign a slow in-memory placer so it finds a machine with enough free RAM, resizes tables, and moves them quickly, while justifying a placement policy.
Model answerdata-structure-designbisectbest-fitschedulingSimulate insert, remove and top-k queries on a multiset using a snapshot pool whose stale entries are discarded lazily, testing hash maps with heaps and exact rule-following.
Auto-gradedhash-mapheaplazy-deletiondesignBuild a store that returns the latest value at or before a query time, then suggest new connections to a user based on having at least two friends in common.
Model answerbinary-searchhash-mapgraphdesignPrecompute the smallest distance between equal values in an array once, then answer many "repeat within k" and "closest repeat" queries in constant time each.
Auto-gradedhash-mappreprocessingbatch-queriesarraysSimulate a full 13-trick, four-player card game with deterministic dealing, follow-suit rules, and point scoring, and return the complete game record.
Auto-gradedsimulationstate-managementsortinghash-mapReview a small Python module for finding and labeling nearby places, spotting correctness, speed and design problems, then propose and justify concrete refactors.
Model answercode-reviewpythongeospatialhaversineSimulate a stateful multinomial Naive Bayes model driven by fit and predict commands, using smoothed log-probabilities and a deterministic tie-break.
Auto-gradednaive-bayessimulationlog-probabilitiessmoothingSimulate a batch of commands on a per-key timestamped value history and an event log, using binary search for point-in-time lookups and inclusive range counts.
Auto-gradedbinary-searchhash-mapdesignsimulationSimulate a fixed-capacity key-value store that evicts the least recently used entry, processing a batch of get and put commands in constant time each.
Auto-gradedhash-mapdoubly-linked-listlru-cachesimulationBuild a picker that returns an item with probability proportional to its weight, even when weights and their total exceed 32-bit or 64-bit limits, and discuss precision and memory trade-offs.
Model answerrandomized-algorithmsprefix-sumbinary-searchalias-methodDesign the types and API that compute an employee's full cost from salary, tax, benefits, and a signed location adjustment, with exact money math, explicit missing-rule handling, and versioned rules.
Model answerobject-modelingapi-designmoney-handlingconfiguration-versioningBuild a thread-safe player where a decoder thread fills a bounded buffer and a render thread emits frames at a fixed rate on a monotonic clock, with clean pause, stop and underrun handling.
Model answerconcurrencyproducer-consumerthreadingschedulingDesign and implement a reusable select-style menu in React with controlled and uncontrolled state, keyboard support, ARIA semantics, and a plan for production hardening.
Model answerreactfrontendaccessibilitycomponent-designSimulate a class through an operations list, tracking per-order and per-group start and end times so lookups run in constant time, with groups reporting 0 while any member is open.
Auto-gradedhash-mapdesignsimulationaggregationDesign a class that maintains mark-to-market profit for many tag-filtered trade groups while trades and price ticks stream in, without rescanning trade history on each update.
Model answerdesignhashingincremental-updatelazy-evaluationDesign a Minesweeper bot that derives certain mines and safe cells from overlapping numbers, estimates mine probabilities when it must guess, and is evaluated by win rate.
Model answerminesweeperconstraint-satisfactionprobabilitybacktrackingSimulate a duplicate-log filter driven by an operation script, tracking per-message cooldowns where only accepted messages restart the timer.
Auto-gradedhash-mapdesignsimulationrate-limitingMove a rectangular block inside a 2D grid without corrupting overlapping data, then run a sliding-window duplicate filter over a list of timestamps.
Auto-gradedmatrixin-placesliding-windowdequeWrite Java versions of a lazy thread-safe Singleton, a Factory Method and a Strategy, weigh them against each other, then refactor a Singleton dependency to use injection.
Model answerdesign-patternsjavasingletonfactory-methodBuild an in-memory ledger supporting account creation, deposits and transfers, plus a query returning the top n senders by cumulative outgoing amount with deterministic tie-breaking.
Model answerdata-structure-designhash-mapheaptop-kBuild an in-memory job dispatcher where workers hold timed leases, stale workers are fenced off, jobs form a dependency DAG, and you justify the delivery guarantees.
Model answerleasesfencing-tokensdagtopological-sortSimulate independent per-tab navigation timelines with a cursor, supporting visit, back and forward, and replay a batch of operations to collect their results.
Auto-gradeddesignhash-mapsimulationcursorDesign a sampler that picks an index in proportion to its weight, supports weight changes, draws several distinct items, and can be seeded and tested statistically.
Model answerweighted-samplingfenwick-treeprefix-sumsbinary-searchMaintain a set of half-open real intervals under add, remove and fully-covered queries, merging touching spans and splitting spans on removal.
Auto-gradedintervalsbinary-searchsimulationsorted-listDesign a billing ledger that merges streamed token deltas and one-shot totals, validates events strictly, and keeps all money as integer nano-USD to avoid floating-point drift.
Model answerdesign-dshash-mapvalidationstate-machineExtend a small FastAPI service with replace and remove routes that follow existing conventions, handle idempotency and errors correctly, and ship with a full test suite.
Model answerfastapirest-apipydantichttp-status-codesDesign an in-memory grid of numeric and formula cells in Python, reject circular dependencies, allow shared references, and compare lazy evaluation against eager recomputation with caching.
Model answerdesigngraphcycle-detectionmemoizationSimulate a fleet telemetry service that tracks per-forklift pings in a global 15-minute window, handles late pings, and counts clocked-in forklifts.
Auto-gradedsliding windowheaphash mapdata structure designSimulate a paginator that serves pages forward and backward from integer cursors, with correct clamping at both ends and for a short final page.
Auto-gradeddesignpaginationsimulationarray-slicing