KatInterview

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

Data Structure Design Interview Problems

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

5981
Problems
2215
Auto-graded
15
Topics
272
Added today

Showing 241–270 of 738 results

  • 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 DesignMediumAuto-graded
    Design an In-Memory Database Engine

    Simulate an in-memory single-table key-value store supporting lookup, update, and sorted conditional selection queries.

    Data Structure Designhash-mapdesignsortingstrings
  • Data Structure DesignMediumAuto-graded
    Fuse Two Sensor Pipelines Into One Object History Log

    Simulate a tracker that links IDs across two systems, stores observations, and returns time-ordered merged histories, testing union-find style grouping and operation replay.

    Data Structure Designunion-finddesignhash-mapsorting
  • Data Structure DesignMediumAuto-graded
    Alias Method Categorical Sampler

    Generate discrete random samples according to custom category weights in constant time per sample using Vose's alias algorithm.

    Data Structure Designarraysdesign-dsmath-bits
  • Data Structure DesignHardAuto-graded
    State-Tracked Recipe Basket with Bulk Pricing

    Simulate a versioned basket engine that aggregates multi-recipe component quantities for bulk discount calculations, supporting mutations and rollback operations.

    Data Structure Designdesign-dsarrayshashing
  • 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 DesignMediumAuto-graded
    Sharded Order Book Simulator with Cancel and Open Lookup

    Simulate a sharded order book that routes users with FNV-1a, enforces a one-way status lifecycle, and answers per-user open-order queries in placement order.

    Data Structure Designhash-mapsimulationstate-machinehashing
  • 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 DesignMediumAuto-graded
    Rolling Read/Write Rate Tracker for an In-Memory Dictionary Store

    Simulate a key-value store that logs reads and writes with timestamps and answers per-second average rate queries over trailing windows, using compact time buckets.

    Data Structure Designdesignsliding-windowdequehash-map
  • Data Structure DesignMediumAuto-graded
    Multi-Channel Message Router with Pluggable Responders

    Simulate a command-driven chat engine that dispatches messages to registered responders, keeps per-channel logs and per-responder state, and returns the resulting logs.

    Data Structure Designdesignsimulationoophash-map
  • Data Structure DesignMediumAuto-graded
    Risk-Ranked Alert Queue Simulator

    Simulate a priority queue of alerts that serves the highest risk first and the oldest first on ties, driven by a list of Put and GetNext commands.

    Data Structure Designpriority-queueheapdesignsimulation
  • Data Structure DesignHardAuto-graded
    Simulate a Time-Aware Financial Ledger

    Process sequential financial operations with scheduled transfers, account merging, historical snapshot queries, and activity rankings using heaps and binary search.

    Data Structure Designdesign-dsheaps-sortingarrays
  • 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
  • Data Structure DesignMediumAuto-graded
    Frozen-View Integer Set with Independent Cursors

    Simulate a mutable integer set whose iterators capture the set's contents at creation time and stay isolated from later changes and from each other.

    Data Structure Designdesignhash-setiteratorsnapshot
  • Data Structure DesignMediumModel answer
    Build a Persistent Key-Value Shell with Tests and CI

    Design a single-class interactive key-value shell that saves to disk, handles bad input, logs errors, accepts new commands easily, and ships with unit tests, a README, and CI.

    Data Structure Designoopcliunit-testingpersistence
  • Data Structure DesignMediumAuto-graded
    Stateful Banking System Ledger Engine

    Simulate an in-memory banking ledger that processes chronologically ordered operations involving balances, leaderboards, delayed cashbacks, and account merges.

    Data Structure Designdesign-dsheaps-sortingarrays
  • Data Structure DesignHardModel answer
    Expiring Resource Credit Ledger with Out-of-Order Events

    Design an in-memory compute credit ledger handling expiring grants, usage subtractions with earliest-expiration priority, out-of-order event ingestion, and point-in-time balance queries.

    Data Structure Designdesign-dsheaps-sortinggreedy-intervalsarrays
  • Data Structure DesignMediumModel answer
    Reconcile Cached Coverage Status with Out-of-Order Checks

    Build a reconciler that keeps a cached insurance status correct when verification results arrive late, duplicated, or as failures, and that can rebuild the status from full history.

    Data Structure Designidempotencyout-of-order eventscache consistencystate reconciliation
  • Data Structure DesignMediumAuto-graded
    Call-Signature Cache with Least-Recently-Used Eviction

    Simulate a fixed-capacity LRU cache keyed by a call's positional and keyword arguments, with order-insensitive, type-aware key matching.

    Data Structure Designlru-cachehash-mapdoubly-linked-listcanonical-keys
  • Data Structure DesignMediumAuto-graded
    Thread-Safe Inventory Management

    Simulate concurrent inventory purchases and sales ensuring atomic state updates, preventing negative inventory, and handling invalid operations cleanly.

    Data Structure Designdesign-dsarraysconcurrency
  • Data Structure DesignMediumModel answer
    Log Test Executions and Query Failure Recovery and Concurrent Failures

    Design an event-driven system to track test statuses, calculate minimum recovery durations, and identify the longest continuous window of high concurrent failures.

    Data Structure Designdesign-dsgreedy-intervalsarrays
  • Data Structure DesignHardAuto-graded
    State-Driven Job Scheduler with DLQ and Dependencies

    Simulate an event-driven task queue handling execution states, lease timeouts, retry budgets, dependencies, and dead-letter cascading.

    Data Structure Designdesign-dsheaps-sortingtrees-graphsstacks-queues
  • Data Structure DesignMediumModel answer
    Designing Dynamic Load Balancers: Round-Robin and Consistent Hashing

    Implement a resilient round-robin request balancer that handles dynamic server membership, followed by a consistent hashing router to maintain key affinity.

    Data Structure Designdesign-dshashingconcurrencybinary-search
  • Data Structure DesignMediumAuto-graded
    Banned-Word Review Screener with Per-User Strike Counts

    Simulate a stateful screening service driven by an operation log: whole-token, case-insensitive banned-word checks, replaceable word lists, and per-user flagged-review tallies.

    Data Structure Designhash-sethash-mapsimulationstrings
  • Data Structure DesignMediumModel answer
    Refactoring and Hardening a Driver Dispatch Service

    Identify anti-patterns in legacy dispatch assignment code, implement fixes, introduce domain types, and design for thread-safety.

    Data Structure Designrefactoringthread-safetyobject-oriented-designclean-code
  • Data Structure DesignMediumAuto-graded
    Least Recently Used Storage Simulation

    Simulate a fixed-capacity Least Recently Used (LRU) storage engine that processes lookup and insert operations in O(1) time.

    Data Structure Designdesign-dslinked-listsarrays
  • Data Structure DesignMediumModel answer
    Build Stateful Round-Robin and Consistent Hash Load Balancers

    Implement thread-safe Round-Robin and Consistent Hashing balancers supporting health checks and dynamic nodes, then analyze their performance.

    Data Structure Designload-balancerconsistent-hashinground-robindata-structure-design
  • Data Structure DesignMediumModel answer
    Build an In-Memory Playlist Engine with a Three-Slot Favorites Set

    Design a thread-safe in-memory audio player with a queue, history, and a favorites list capped at three that rejects overflow deterministically rather than evicting.

    Data Structure Designdesigndequehash-mapconcurrency