KatInterview

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

Data Structure Design Interview Problems

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

5971
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 91–120 of 362 results

  • Data Structure DesignMediumModel answer
    C++ Polymorphism: Overridable Methods vs Mandatory Interface Methods

    Explain how C++ virtual and pure virtual functions differ, how vtable dispatch works, when a class is abstract, and how virtual destructors affect safe cleanup.

    Data Structure Designcpppolymorphismvtableabstract-classes
  • Data Structure DesignMediumModel answer
    Design a Resilient In-Memory Task Queue with Worker Failure Handling

    Build a thread-safe, in-process job queue that handles worker crashes, lease timeouts, late reports, and retry bounds using deterministic testing mechanics.

    Data Structure Designdesign-dsstacks-queuesconcurrencythreads
  • Data Structure DesignMediumModel answer
    Non-Blocking Concurrent Log Writer with Bounded Buffer

    Build 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.

    Data Structure Designconcurrencyproducer-consumerbounded-queuebackpressure
  • Data Structure DesignMediumModel answer
    Build an In-Memory Ledger with Deposits and Transfers

    Implement an in-memory ledger class supporting account creation, deposits and transfers, with clear return codes, invariants, retry safety and concurrency choices.

    Data Structure Designhash-mapclass-designidempotencyconcurrency
  • Data Structure DesignMediumModel answer
    Slot Availability Queries on a Sparse Number Line

    Handle 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.

    Data Structure Designbinary-searchsorted-structuresfenwick-treecoordinate-compression
  • Data Structure DesignMediumModel answer
    Build an In-Memory File Store with Quotas and Backups

    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.

    Data Structure Designdata-structure-designhash-mapheapin-memory-storage
  • Data Structure DesignMediumModel answer
    Reversible Wallet Balance Tracker with Undo and Redo

    Design 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.

    Data Structure Designdesignundo-redostackscommand-pattern
  • Data Structure DesignMediumModel answer
    Review a Fit/Transform Preprocessing Module and Write a Key Test

    Review 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.

    Data Structure Designpythoncode-reviewscikit-learnunit-testing
  • Data Structure DesignMediumModel answer
    Single-Open Async Tooltip Panels with Keyboard Support in React

    Design a React popover that fetches data when opened, stays exclusive across many triggers, ignores stale responses, and handles focus, Esc, and outside clicks accessibly.

    Data Structure Designreactaccessibilityrace-conditionsfocus-management
  • Data Structure DesignMediumModel answer
    Pluggable Scoring Pipeline for Ranking Concert and Show Listings

    Design 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.

    Data Structure Designobject-oriented-designstrategy-patternrankingfallback
  • Data Structure DesignMediumModel answer
    Build a CSV Data Frame and Assembly of Sequence Fragments

    Parse RFC 4180 CSV into an in-memory table with query support, and reconstruct chained sequences from directed or undirected overlapping fragments.

    Data Structure Designdesign-dsstringstrees-graphs
  • Data Structure DesignMediumModel answer
    Build a Bucketed Spatial Index for Planar Points

    Implement a region quadtree that stores 2D points in capacity-limited buckets, splits into four quadrants on overflow, and answers rectangular range queries efficiently.

    Data Structure Designquadtreespatial-indexrecursionrange-query
  • Data Structure DesignMediumModel answer
    Build a Bounded Permit Task Execution Engine

    Implement a concurrency manager that controls variable permit usage per task, supports blocking and asynchronous execution, and guarantees safe permit releases.

    Data Structure Designconcurrencysynchronizationdesign-dsthreading
  • Data Structure DesignMediumModel answer
    Build a Biased Index Picker Using Cumulative Totals

    Design 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.

    Data Structure Designprefix-sumbinary-searchrandom-samplingfenwick-tree
  • Data Structure DesignMediumModel answer
    Trailing-Day Campaign CTR over Two Skewed Event Feeds

    Build 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.

    Data Structure Designstreamingsliding-windowheaphash-map
  • Data Structure DesignMediumModel answer
    Proportional Random Index Picker with Fast Repeated Queries

    Design a class that returns a random index with probability proportional to its weight, optimized for many repeated draws after one-time setup.

    Data Structure Designprefix-sumsbinary-searchrandom-samplingfenwick-tree
  • Data Structure DesignMediumModel answer
    Const Pointer Variants and Choosing Between Tree and Hash Maps in C++

    Explain 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.

    Data Structure Designcppconst-correctnesspointersstd-map
  • Data Structure DesignHardModel answer
    Build a Jungle Board Game Engine with Class Hierarchies

    Design 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.

    Data Structure Designobject-oriented-designgame-enginepolymorphismclass-design
  • Data Structure DesignMediumModel answer
    Build a Keyed Task Dispatcher with Global Concurrency Cap

    Design 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.

    Data Structure Designconcurrencythread-safetyexecutorqueues
  • Data Structure DesignMediumModel answer
    Random Equipment Lending Pool with Constant-Time Operations

    Build 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.

    Data Structure Designhash-maprandomizedswap-and-popinsert-delete-getrandom
  • Data Structure DesignMediumModel answer
    Design a Phone-Style Calculator in the Browser

    Build a four-function calculator UI with immediate-execution semantics, tricky key sequences handled correctly, and a layout close to a familiar mobile calculator.

    Data Structure Designstate-machinefrontendjavascriptedge-cases
  • Data Structure DesignEasyModel answer
    Log a Button's Label on Click with the DOM Event API

    Wire 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.

    Data Structure Designjavascriptdomevent-handlingfrontend-fundamentals
  • Data Structure DesignEasyModel answer
    Immutable Folder Tree State with Safe Move and Delete

    Design a normalized, immutable state model for a nested folder tree and implement add, move (with cycle rejection) and recursive delete efficiently for deep trees.

    Data Structure Designtreestate-managementimmutabilitycycle-detection
  • Data Structure DesignMediumModel answer
    Task Scheduling Order and Undoable Command Pipeline

    Resolve prerequisite-constrained task sequences with cycle detection, then construct an extensible Command pattern system with state rollback functionality.

    Data Structure Designtrees-graphsdesign-dsstacks-queues
  • Data Structure DesignHardModel answer
    Blocking Bounded Buffer for Many Producers and Consumers

    Design and code a fixed-capacity, multi-producer multi-consumer buffer with timed blocking put/get, fair waiter ordering, clean shutdown and backpressure, and explain how you would test it.

    Data Structure Designconcurrencysynchronizationcondition-variablesbackpressure
  • Data Structure DesignHardModel answer
    Distributed Block Matrix Multiplication via Cannon's Algorithm

    Coordinate grid-based worker nodes to perform memory-efficient distributed matrix multiplication without deadlocks.

    Data Structure Designdistributed systemsmatrix multiplicationconcurrencyalgorithms
  • Data Structure DesignMediumModel answer
    Layered Ledger Service: Cash, Transfers, Fees and Held Funds

    Design and code a bank ledger that grows in stages: cash operations, per-account statements with failures, internal and external transfers with fees, and delayed transfers that lock funds.

    Data Structure Designledgermoney-handlingobject-oriented-designtransactions
  • Data Structure DesignMediumModel answer
    Build an In-Memory Ledger with Delayed Rewards and Account Merging

    Design an in-memory ledger that handles idempotent transfers, top-k senders, rewards posted 24 hours after a purchase, and account merging, and explain how you would test and scale it.

    Data Structure Designdesignhash-mapheapidempotency
  • Data Structure DesignMediumModel answer
    Ad Campaign Event Aggregator with Pluggable Event Types

    Design an object-oriented component that ingests ad events and returns windowed per-campaign metric sums and ratios, while letting new event types be added without editing core code.

    Data Structure Designobject-oriented-designtime-seriesprefix-sumsbinary-search
  • Data Structure DesignMediumModel answer
    Implement Dynamic Bitwise Masking and Uniform O(1) Set

    Construct an XOR string transformation function alongside an expected constant-time randomized container structure.

    Data Structure DesignArraysHash MapBit ManipulationDesign