Topic
Data Structure Design interview problems
Caches, iterators, rate limiters and custom containers. 738 original problems, each with hidden test cases you can run in the browser.
53 easy588 medium97 hard
Showing 211–240 of 738 results
Implement 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-storageDesign an in-memory wallet class that applies relative changes and absolute resets to an integer-cent balance, with full undo and redo and constant-time operations.
Model answerdesignundo-redostackscommand-patternReview a small Python preprocessing module with an outlier-capping class and three imputers: explain its purpose, justify fit/transform separation, critique style and imports, and write one key unit test.
Model answerpythoncode-reviewscikit-learnunit-testingSimulate a record store that applies updates with optimistic version checks and per-record idempotency keys, replaying cached results for retries and rejecting reused keys.
Auto-gradeddesignhash-mapidempotencyoptimistic-concurrencyDesign a React popover that fetches data when opened, stays exclusive across many triggers, ignores stale responses, and handles focus, Esc, and outside clicks accessibly.
Model answerreactaccessibilityrace-conditionsfocus-managementSimulate a key-value store with nested begin, commit and rollback by replaying a command list and recording each read result.
Auto-gradedhash-mapstacktransactionsundo-logDesign an object-oriented ranking engine where scoring and filtering rules can be chained, weighted, reordered and isolated from failures, with a backfill tier when too few results come back.
Model answerobject-oriented-designstrategy-patternrankingfallbackParse RFC 4180 CSV into an in-memory table with query support, and reconstruct chained sequences from directed or undirected overlapping fragments.
Model answerdesign-dsstringstrees-graphsSimulate keystroke-by-keystroke search suggestions over a frequency-weighted history that grows as queries are committed, ranking the top 3 matches by count and then text.
Auto-gradedhash-mapdesignstring-prefixtop-kImplement a region quadtree that stores 2D points in capacity-limited buckets, splits into four quadrants on overflow, and answers rectangular range queries efficiently.
Model answerquadtreespatial-indexrecursionrange-queryImplement a concurrency manager that controls variable permit usage per task, supports blocking and asynchronous execution, and guarantees safe permit releases.
Model answerconcurrencysynchronizationdesign-dsthreadingDesign a class that returns an index at random with probability proportional to its weight, then explain how to make each draw fast and how to handle updates.
Model answerprefix-sumbinary-searchrandom-samplingfenwick-treeBuild a generator that emits per-campaign impression, click and CTR figures over a trailing 24-hour window, counting one click per impression and accepting events up to 10 minutes late.
Model answerstreamingsliding-windowheaphash-mapDesign a class that returns a random index with probability proportional to its weight, optimized for many repeated draws after one-time setup.
Model answerprefix-sumsbinary-searchrandom-samplingfenwick-treeImplement an in-memory venue reservation system supporting quick seat allocation, cancellation tracking, and capacity queries.
Auto-gradedhash-tabledesignstacksdata-structuresExplain how const placement changes pointer and pointee mutability in C++, then compare std::map and std::unordered_map on structure, complexity, ordering, key needs and use cases.
Model answercppconst-correctnesspointersstd-mapDesign the classes for a two-player Jungle (Dou Shou Qi) engine: eight animals, a 9x7 board with water, traps and dens, capture and jump rules, a small API, and tests.
Model answerobject-oriented-designgame-enginepolymorphismclass-designDesign a component that runs tasks in strict order per key, lets different keys run in parallel up to a global limit, and stays correct under concurrent submits and task failures.
Model answerconcurrencythread-safetyexecutorqueuesSimulate a chat activity tracker with a closed rolling window, touch/close liveness rules, and out-of-order events, using bounded-memory eviction.
Auto-gradeddesignhash-mapheapsliding-windowBuild an in-memory pool that lends out a uniformly random free item to a borrower, accepts returns, and allows retirement of idle items, with every operation in O(1) average time.
Model answerhash-maprandomizedswap-and-popinsert-delete-getrandomSimulate an event-driven dispatching system that maintains pending requests ordered by pickup time and processes state updates efficiently using heaps and hash maps.
Auto-gradedheaphash-tabledesignsortingSimulate a storage pool that reserves the leftmost run of contiguous free cells per request and releases everything an owner holds, using efficient free-run tracking.
Auto-gradedsegment-treesimulationinterval-merginghash-mapCount unique strings in a list by building a custom hash table with probing, without using built-in sets, dictionaries, or similar lookup containers.
Auto-gradedhash-tableopen-addressingstringshashingBuild a four-function calculator UI with immediate-execution semantics, tricky key sequences handled correctly, and a layout close to a familiar mobile calculator.
Model answerstate-machinefrontendjavascriptedge-casesProcess a stream of score updates and queries, returning the rolling average and maximum over the latest score of each chat inside a half-open time window.
Auto-gradedsliding-windowhash-mapqueuelazy-deletionWire up a click handler on a page button that logs its label to the console, and explain what the event object's target property refers to, including nested-element cases.
Model answerjavascriptdomevent-handlingfrontend-fundamentalsProcess a stream of checksummed events with duplicates and out-of-order timestamps, reporting a running average payload length over a 60-second window using a queue, a set and a running sum.
Auto-gradeddequesliding-windowhash-setstreamingDesign a normalized, immutable state model for a nested folder tree and implement add, move (with cycle rejection) and recursive delete efficiently for deep trees.
Model answertreestate-managementimmutabilitycycle-detectionSimulate round-robin package allocation across nodes with cycle resets, capacity limits, and permanent node shutdowns.
Auto-gradedarraysdesign-dssimulationResolve prerequisite-constrained task sequences with cycle detection, then construct an extensible Command pattern system with state rollback functionality.
Model answertrees-graphsdesign-dsstacks-queues