KatInterview

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

Data Structure Design Interview Problems

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

5987
Problems
2219
Auto-graded
15
Topics
270
Added today

Showing 331–360 of 739 results

  • 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 DesignEasyAuto-graded
    Bunk Allocation by Preferred Room Size

    Match students to rooms by hard size preference in input order, respecting capacity, keeping partially filled rooms, and reporting students who could not be placed.

    Data Structure Designqueuessimulationhash-mapgreedy
  • 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 DesignMediumAuto-graded
    Command-Driven Ledger with Transfer Volume Leaderboard

    Simulate an in-memory ledger from text commands, with validated transfers and a leaderboard ranked by outgoing volume with an alphabetical tie-break.

    Data Structure Designhash-mapsimulationsortingstring-parsing
  • 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 DesignMediumAuto-graded
    Simulate a Topic Message Broker with Subscription Tokens

    Simulate a topic-based message broker from a command log, handling token issuance, ordered delivery records, and idempotent unsubscribes.

    Data Structure Designdesignhash-mapsimulationordering
  • 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 DesignMediumAuto-graded
    Work Queue Tracker with Owners, Closing, and Late Lookups

    Simulate a task tracker driven by a list of operations, handling creation, reassignment, completion, and multi-key sorted queries while returning one result per operation.

    Data Structure Designdesignhash-mapsortingsimulation
  • 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 DesignMediumAuto-graded
    Per-Key Cooldown Filter for a Timestamped Event Feed

    Walk a time-ordered event feed and decide which events pass a 10-second per-key cooldown, where only accepted events restart the cooldown.

    Data Structure Designhash-mapsimulationrate-limitingstreams
  • 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 DesignMediumAuto-graded
    Funding Ledger with Rail-Specific Settlement and Window Caps

    Simulate an ordered account ledger where each payment rail has its own settlement delay, cutoff-shifted window assignment, and per-window cap, and output the combined results.

    Data Structure Designsimulationhash-mapheapdesign
  • 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 DesignMediumAuto-graded
    Subtree Totals Under Collapse and Graft Operations

    Maintain per-node totals in a rooted tree while nodes are collapsed into leaves or have a subtree grafted onto a leaf, answering total queries after each change.

    Data Structure Designtreehash-mapsimulationparent-pointers
  • Data Structure DesignMediumAuto-graded
    Alive-Node Graph Simulator with Gated Edge Insertion

    Simulate a sequence of node toggles, edge edits, and connectivity queries on an undirected graph where only alive nodes count and edges are only added between alive endpoints.

    Data Structure Designunion-findgraphsimulationconnected-components
  • Data Structure DesignMediumAuto-graded
    Nearest Working Charger: Command Simulator with Great-Circle Math

    Process a batch of commands on a charging-station registry, with status updates, spherical distance and nearest-online lookups that break ties deterministically.

    Data Structure Designdesignsimulationhaversinesorting
  • 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 DesignMediumAuto-graded
    Recency-Evicting Store Simulation Plus Graph Group Tally

    Simulate a fixed-size recency-evicting key-value store from a command log, and separately count connected groups in an undirected graph, returning both results together.

    Data Structure Designlru-cachehash-mapordered-dictunion-find
  • 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 DesignMediumAuto-graded
    Subtree Earnings Ledger with Ranked Threshold Queries

    Simulate a command sequence on a referral forest, maintaining subtree revenue totals and answering ranked queries filtered by a strict threshold.

    Data Structure Designhash-maptreesimulationsorting
  • 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 DesignMediumAuto-graded
    Replay Operations on a Skip-Ahead Iterator

    Simulate a forward-only iterator that yields every k-th element, with an idempotent has-next check, and return the results of a scripted sequence of operations.

    Data Structure Designiteratorsimulationstate-managementdesign
  • Data Structure DesignMediumAuto-graded
    Parcel Runner Payout Ledger with Peak Overlap Queries

    Simulate a stateful ledger driven by operation lists: track per-runner payout sums and compute maximum simultaneous half-open intervals clipped to a query window.

    Data Structure Designsweep-linehash-mapintervalssimulation
  • Data Structure DesignMediumAuto-graded
    Batch Runner for a Slash-Separated Key Store

    Simulate a hierarchical key store from a batch of create/get commands, where a key can only be created once its parent key already exists.

    Data Structure Designdesignhash-maptriesimulation
  • Data Structure DesignMediumAuto-graded
    Healthy Region Registry and Nearest-Site Router

    Simulate a command interpreter that registers sites, toggles their health, and answers nearest-healthy-site queries by great-circle distance, with strict validation and tie-breaking.

    Data Structure Designsimulationstring-parsinghash-mapvalidation
  • Data Structure DesignEasyAuto-graded
    Most Likely Follower Lookup Over Streaming Sentences

    Process a stream of add and query operations over sentences, tracking adjacent-word counts and returning the most frequent follower with lexicographic tie-breaking.

    Data Structure Designhash-mapstringssimulationcounting