KatInterview

practice a little every day — you've got this ♡

Data Structure Design Interview Problems

Practice 5973 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.

5973
Problems
2212
Auto-graded
15
Topics
271
Added today

Showing 151–180 of 362 results

  • Data Structure DesignMediumModel answer
    Simulate Message Spreading in an Orbital Network

    Simulate timed, discrete-event message propagation across a satellite graph and fire report callbacks in exact time and ID order.

    Data Structure Designtrees-graphsheaps-sortingdesign-ds
  • Data Structure DesignMediumModel answer
    Build a Bounded, Thread-Safe Resource Pool with Timeouts

    Implement a thread-safe pool that lazily creates up to N connections, reuses healthy ones, blocks callers with a deadline when exhausted, and shuts down cleanly.

    Data Structure Designconcurrencythread-safetycondition-variableresource-pool
  • Data Structure DesignMediumModel answer
    Concurrent Least-Recently-Used Cache with Constant-Time Operations

    Build a fixed-capacity cache with O(1) lookup, update and eviction by recency, then make it safe for many threads and state exactly what consistency it guarantees.

    Data Structure Designlru-cachehash-mapdoubly-linked-listconcurrency
  • Data Structure DesignMediumModel answer
    Build an In-Memory Hierarchical File System with CRUD Support

    Design and implement an in-memory key-value store structured as a file system tree supporting create, set, get, and cascade delete operations with path validation.

    Data Structure Designdesign-dstrees-graphsstrings
  • Data Structure DesignHardModel answer
    Per-User Rolling Quota Gate with Concurrent Access

    Design a thread-safe class that caps how many requests each user may make in any trailing time interval, avoiding the burst problem of fixed windows, with sub-linear cost per check.

    Data Structure Designrate-limitersliding-windowdequeconcurrency
  • Data Structure DesignHardModel answer
    Escalation Counters and Level Changes in a Review Pipeline

    Design a cached repeat-alert counter that triggers rejection of a work order, then extend it so an alert's severity can change without corrupting counts or past decisions.

    Data Structure Designcachingidempotencyconcurrencyversioning
  • Data Structure DesignMediumModel answer
    Design an Extensible Boolean Rule Evaluation Engine

    Construct an object-oriented expression tree for logical and comparison operations that evaluates safely against context dictionaries with short-circuiting.

    Data Structure Designobject-oriented-designtreecomposite-patternevaluation-engine
  • Data Structure DesignMediumModel answer
    Build an In-Memory Store with Nested Transactions and Value Counts

    Design a string key-value store with transactional writes, fast rollback, and a count of keys holding a given value, with all transaction semantics spelled out.

    Data Structure Designhash-maptransactionsundo-logdesign
  • Data Structure DesignMediumModel answer
    In-Memory Calendar Service and Interval Queries

    Design and implement an in-memory calendar event service with full CRUD operations, validation rules, conflict detection, and unit testing strategy.

    Data Structure Designdesignintervalscrudvalidation
  • Data Structure DesignMediumModel answer
    Design a Weighted Sampling Generator with Dynamic Updates

    Implement a class for weighted sampling that supports O(1) sampling for static inputs and logarithmic updates for dynamic environments.

    Data Structure Designdesign-dsheaps-sortingmath-bits
  • Data Structure DesignMediumModel answer
    Cross-Venue Quote Book and Arbitrage Scanner

    Build an in-memory engine that keeps the latest valid top-of-book quote per venue, expires old ones, and reports the most profitable buy-low/sell-high pair across venues.

    Data Structure Designclass-designhash-mapmarket-dataedge-cases
  • Data Structure DesignMediumModel answer
    Thread-Safe Ledger Accounts with Transfer and Absorb Operations

    Design a concurrency-safe Account class supporting deposits, withdrawals, atomic transfers, and absorbing another account, while preventing overdrafts, deadlocks, and operations on closed accounts.

    Data Structure Designoopconcurrencylockingdeadlock
  • Data Structure DesignMediumModel answer
    Object-Oriented Design for a Multi-Floor Garage Allocator

    Design classes and an allocation API for a multi-floor garage that assigns the closest suitable bay to each vehicle, stays correct under concurrent requests, and handles a full garage.

    Data Structure Designobject-oriented-designconcurrencyheaplow-level-design
  • Data Structure DesignMediumModel answer
    Build a Three-Stage Signup Wizard with React Reducer State

    Design a React wizard with profile, address and review stages, covering validation, guarded navigation, disabled controls, a submit spinner and server error display, plus scaling and performance trade-offs.

    Data Structure DesignreactformsuseReducervalidation
  • Data Structure DesignMediumModel answer
    Strong vs Weak Counts in shared_ptr and How weak_ptr Breaks Cycles

    Describe the two reference counts in a shared_ptr control block, how weak_ptr uses them, why lock() is needed, and how a weak back-edge fixes a leaking ownership cycle.

    Data Structure Designcppsmart-pointersshared_ptrweak_ptr
  • Data Structure DesignMediumModel answer
    Tackling Long-Winded Data Structure Design Problems Step by Step

    Describe a repeatable process for data-structure designs that are simple to state but long to code, then apply it to a price-time-priority limit order book.

    Data Structure Designdata-structure-designorder-bookinvariantslazy-deletion
  • Data Structure DesignMediumModel answer
    Build a Persistent Storage Layer for a Mini Database Engine

    Design and implement the last stage of a database engine: a catalog of databases, schemas, and tables plus durable row insert, read, update, and delete that survives restarts.

    Data Structure Designstorage-enginepersistencecrash-safetywrite-ahead-log
  • Data Structure DesignMediumModel answer
    Build a Run-Once Typewriter Component for a Hidden Token

    Build a React and TypeScript component that finds a hidden token in the DOM or over HTTP, types it out every 50ms, never replays the animation, cleans up after itself, and has Mocha tests.

    Data Structure Designreacttypescripthooksasync
  • Data Structure DesignMediumModel answer
    Frequency-Ranked Shuffle Without Repeats Per Round

    Build a player that ingests users' song lists and serves songs from most to least popular, never repeating a song until every known song has played once in the round.

    Data Structure Designheaplazy-deletionhash-mapdesign
  • Data Structure DesignHardModel answer
    Pattern Router for Sensor Topics with Placeholders and a Tail Wildcard

    Design a router that maps dot-separated topics to registered patterns with named placeholders and a trailing "**", using strict left-to-right precedence and backtracking.

    Data Structure Designtriebacktrackingroutingpattern-matching
  • Data Structure DesignMediumModel answer
    Live-Streaming Prompt Box with Incremental Reply Rendering

    Design and code a small front-end component that sends a prompt, renders a streamed reply as it arrives, blocks duplicate sends, supports cancel, and shows loading and error states.

    Data Structure Designfrontendreactstreamingasync-state
  • Data Structure DesignMediumModel answer
    Pointers vs References in C++: Semantics and API Design

    Contrast C++ raw pointers with references, choose the right parameter and return types for four trading-engine APIs, and explain how aliasing affects optimization.

    Data Structure Designcpppointersreferencesapi-design
  • Data Structure DesignMediumModel answer
    Python Deep Dive: Concurrency, Generators, Typing and Memory

    Nine-part Python fundamentals review covering the GIL, concurrency models, decorators, generators, typing, packaging, profiling, memory management and exceptions.

    Data Structure Designpythongilconcurrencygenerators
  • Data Structure DesignMediumModel answer
    Resilient Chargeback Inbox: Normalize, Cache, and Cancel in React

    Build a React dispute list that normalizes inconsistent API data, caches queries for 60 seconds, and avoids stale responses when filters or search change quickly.

    Data Structure Designreacttypescriptcachingrace-conditions
  • Data Structure DesignHardModel answer
    Eagerly Cached Cell Grid with Dependency Tracking

    Build a grid of cells that stores integers or sum formulas, keeps every value precomputed for constant-time reads, and refuses any write that would introduce a circular reference.

    Data Structure Designgraphtopological-sortcycle-detectioncaching
  • Data Structure DesignEasyModel answer
    Layered Scopes for a Key-Value Store with Savepoints

    Build an in-memory key-value store whose writes can be grouped into nested, revertable scopes that either merge into the enclosing scope or are thrown away.

    Data Structure Designstackhash-mapdesignscoping
  • Data Structure DesignMediumModel answer
    Run Work Items on Manual Python Threads and Debug Them in Linux

    Fan a function out over a list using a fixed number of hand-made Python threads, capture every result or error, join cleanly, then inspect the live threads from the Linux shell.

    Data Structure Designpythonthreadingconcurrencylinux
  • Data Structure DesignMediumModel answer
    Fixing a Lost-Update Race in a Deposit Method You Cannot Edit

    Diagnose the race in an account deposit that reads, pauses, then writes, and add locking through a subclass, wrapper or embedding in Python and Go without touching the original type.

    Data Structure Designconcurrencyrace-conditionmutexpython
  • Data Structure DesignHardModel answer
    Retroactive Pay Ledger with Rate Changes and Shift Logging

    Design a class that records rate changes and shifts in any order, and reports total earnings under the current rate schedule using prefix sums and binary search.

    Data Structure Designdesignprefix-sumbinary-searchintervals
  • Data Structure DesignMediumModel answer
    Org Chart Inference with Manager and Peer Links

    Design a structure that records manager and same-manager links between employee IDs and answers whether one employee sits above another, including facts inferred from earlier updates.

    Data Structure Designunion-finddesigngraphstransitive-closure