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 181–210 of 737 results
Answer three fundamentals questions: tuple rebinding and shallow immutability, how a hash table handles insert, lookup, update and delete, and where to raise and catch errors in a record class.
Model answerpythonimmutabilitytupleshash-tableReplay a sequence of operations on a stream of integer IDs and report, at each query, the earliest-arriving ID seen exactly once, using a hash map plus an ordered queue.
Auto-gradedhash-mapqueuedesignstreamingAnswer many prefix queries against a word list, returning sorted distinct matches for each, using sorting and binary search or a trie instead of rescanning the list per query.
Auto-gradedbinary-searchtriesortingstringsBuild a callback-driven client that gathers individual key requests into one batched GET every 100 ms, using only a timer and an async HTTP primitive, while keeping overlapping batches isolated.
Model answerevent-loopbatchingcallbackstimersTests data structure management and stable sorting to process out-of-order time-stamped events while preserving insertion order for ties.
Auto-gradedsortingdata-structuresdesignSimulate a rate limiter with a fixed lockout window that keeps only the newest waiting request, using event-driven processing and a precise rule for requests landing exactly at window end.
Auto-gradedsimulationevent-driventhrottletwo-pointersSimulate a Least Frequently Used (LFU) cache supporting fast O(1) operations, breaking tie frequencies by least recent usage.
Auto-gradeddesign-dsarrayshash-tableProcess a log of insert and query operations on an integer stream, returning the current median for each query, using two heaps for efficient updates.
Auto-gradedheaptwo-heapsstreamingmedianSimulate a message router that matches nested JSON events against per-queue filter policies and returns matching queues in first-subscription order.
Auto-gradeddesignhash-mapjsonsimulationSimulate a command stream on an in-memory file store with admin and user-owned files, prefix/suffix search, copying, and quota-driven eviction.
Auto-gradedhash-mapsimulationsortingdesignReplay a list of throttle operations and decide, per user, whether each request fits within k accepted requests in a rolling window of t ms, using inclusive boundary rules.
Auto-gradedsliding-windowdequehash-mapsimulationDesign the classes and core move algorithm for a configurable N x N sliding-tile merge puzzle, with testable randomness, win and loss detection, and room for undo.
Model answerobject-oriented-designgame-logicsimulationdependency-injectionSimulate a command sequence on a word index that supports insert, exact lookup, prefix lookup, and alphabetically ordered, capped autocomplete, built on a trie.
Auto-gradedtriedesigndfsstringsSimulate a small in-memory bank driven by a command script, covering account creation, instant and deferred transfers, batch settlement and cancellation of pending transfers.
Auto-gradedsimulationhash-mapstate-managementclass-designDesign a fixed-capacity cache with least-recently-used eviction and per-entry expiry, and justify your data structures, tests and complexity.
Model answerlru-cacheordereddictttlunit-testingWalk through hash table internals: index mapping, chaining versus linear probing, safe deletion, load-factor resizing, and when operations degrade from O(1) to O(n).
Model answerhash-tablecollision-resolutionlinear-probingload-factorDesign a data-driven policy engine whose rules combine field checks with nested AND, OR and NOT, covering representation, validation, missing-field behavior and explainable results.
Model answerexpression-treerules-enginevalidationboolean-logicSimulate a payroll ledger that records work intervals, tracks accrued cost, and settles wages up to a cutoff time without double-paying.
Auto-gradeddesignsimulationintervalsidempotencySimulate a hand-built key-value store with a fixed bucket count by replaying a command log, handling collisions and overwrites correctly without a built-in dictionary.
Auto-gradedhash-tableseparate-chainingsimulationdesignExplain how C++ virtual and pure virtual functions differ, how vtable dispatch works, when a class is abstract, and how virtual destructors affect safe cleanup.
Model answercpppolymorphismvtableabstract-classesBuild a thread-safe, in-process job queue that handles worker crashes, lease timeouts, late reports, and retry bounds using deterministic testing mechanics.
Model answerdesign-dsstacks-queuesconcurrencythreadsMap integer draws to the index whose cumulative weight range contains them, using prefix sums and binary search, driven through a batch of init/query operations.
Auto-gradedprefix-sumbinary-searchdesignbisectAnswer many closest-index-distance queries over a fixed word list by building a position index, precomputing same-word gaps, and binary searching the smaller list.
Auto-gradedinverted-indexbinary-searchpreprocessinghash-mapBuild a thread-safe logger whose callers never wait on slow sink I/O, preserving submission order, bounding memory, and flushing every accepted message on shutdown.
Model answerconcurrencyproducer-consumerbounded-queuebackpressureImplement an in-memory ledger class supporting account creation, deposits and transfers, with clear return codes, invariants, retry safety and concurrency choices.
Model answerhash-mapclass-designidempotencyconcurrencyProcess a stream of pass/fail log operations, answering shortest-fix-time and longest-concurrent-failure-window queries with an incremental, level-based data structure.
Auto-gradeddesignstreamingintervalshash-mapSimulate a fixed-capacity circular FIFO queue from an operation log, handling wraparound, full and empty states, and logical index lookups in constant time per operation.
Auto-gradedcircular-queuering-buffersimulationdesignHandle an online stream of point-blocking and window-clearance queries on a huge integer line, and return a bit string with one result per query.
Model answerbinary-searchsorted-structuresfenwick-treecoordinate-compressionProcess a series of LFU cache queries with LRU tie-breaking and track the output of each operation.
Auto-gradedhash-tablelinked-listdesignlfu-cacheImplement an in-memory file store with prefix top-N queries, per-user quotas, user merging, and per-user backup and restore that never disturb other users.
Model answerdata-structure-designhash-mapheapin-memory-storage