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 271–300 of 362 results

  • Data Structure DesignHardModel answer
    Build a Reference-Counted Pointer from Scratch in C++

    Implement a class template SharedPtr<T> that manages heap object lifetime through reference counting, supporting copy, move, reset, and safe self-assignment.

    Data Structure DesignC++RAIImemory managementtemplates
  • Data Structure DesignMediumModel answer
    Expiring Credit Wallet: Drain Soonest-Expiring First, Halt on Overdraft

    Design an in-memory credit ledger that consumes the earliest-expiring balance first and permanently returns None after any overdraft.

    Data Structure Designheapgreedysimulationexpiry
  • Data Structure DesignMediumModel answer
    Build a Reference-Counted Smart Pointer in C++

    Design and implement a shared ownership pointer with automatic memory management using reference counting and RAII principles.

    Data Structure Designc++memory-managementraiimove-semantics
  • Data Structure DesignMediumModel answer
    Build a nested namespace tree from dotted model parameter names

    Convert a flat list of dotted parameter keys like layer indices into a grouped nested dictionary, collecting nonconforming, duplicate, and structurally conflicting keys separately.

    Data Structure Designstringshashingtrieedge-cases
  • Data Structure DesignMediumModel answer
    Build a Thread-Safe Future: Chaining and Parallel Fan-In

    Implement a generic async future primitive supporting blocking get, callback chaining, and a barrier that resolves when all parallel futures complete.

    Data Structure Designconcurrencyfuturesthreadingcallbacks
  • Data Structure DesignMediumModel answer
    Multi-Level Parking Facility: Class Structure and Operations

    Model a parking facility with levels and sized spots, supporting vehicle entry/exit, spot allocation by compatibility, and availability queries.

    Data Structure Designobject-oriented-designSOLID-principlesdesign-patternsclass-modeling
  • Data Structure DesignMediumModel answer
    Async Query Client for a Cloud Data Warehouse

    Design and implement a lightweight client that submits async SQL queries, polls for status, retrieves results, and handles errors and credentials safely.

    Data Structure Designapi-designasyncerror-handlingstate-machine
  • Data Structure DesignMediumModel answer
    Build a Time-Travel Key-Value Store with Snapshots

    Design a key-value store that supports cheap snapshots and historical reads without copying the entire map on each snapshot.

    Data Structure Designsnapshotsversioningbinary-searchcopy-on-write
  • Data Structure DesignHardModel answer
    Build a thread-safe sliding-window percentile monitor

    Implement a concurrent data structure that tracks latency measurements and computes approximate percentiles over a rolling time window with bounded memory.

    Data Structure Designconcurrencypercentileshistogramsliding-window
  • Data Structure DesignMediumModel answer
    Order Fulfillment Engine with Backorder Queue

    Process a stream of orders and restocks against live inventory, fulfilling backorders in arrival order before replenishing on-hand stock.

    Data Structure Designhash-mapqueuesimulationamortized-analysis
  • Data Structure DesignMediumModel answer
    Design a Money Transfer System with Pending Approvals

    Build an in-memory banking service supporting accounts, transaction history, and two-party transfers that only settle when the recipient explicitly accepts.

    Data Structure Designconcurrencyidempotencystate-machineobject-oriented-design
  • Data Structure DesignMediumModel answer
    Indentation-Aware Code Folding Engine

    Build a class that collapses and restores indentation-defined code blocks, tracking nested fold state and remapping display line numbers after each operation.

    Data Structure Designsimulationmonotonic-stackdata-structure-design
  • Data Structure DesignMediumModel answer
    Short-Circuit Async Boolean: Cancel Early, Return Fast

    Implement an async function that resolves true the moment any concurrent task returns true, cancelling all remaining work immediately.

    Data Structure Designasyncioconcurrencycancellationpython
  • Data Structure DesignMediumModel answer
    Build an In-Memory Notebook System with Rollback

    Design and implement a versioned in-memory notebook system supporting CRUD, case-insensitive search, user management, and full state rollback via a change log.

    Data Structure Designversioningooprollbackhashmap
  • Data Structure DesignMediumModel answer
    React Grid with Formula Dependencies and Virtual Rendering

    Build a React component that displays a large editable grid, evaluates cell formulas with references, detects cycles, and renders only visible rows.

    Data Structure Designreactvirtualizationmemoizationdependency-graph
  • Data Structure DesignHardModel answer
    O(1) Insert, Delete, and Fair Random Draw from a Live Set

    Design a data structure that supports adding, removing, and uniformly sampling integer values, all in average O(1) time with no duplicates.

    Data Structure Designhash maparrayrandomizationdata structure design
  • Data Structure DesignMediumModel answer
    Job Scheduler with Dependency Resolution

    Build a thread-safe scheduler that accepts jobs with dependencies, identifies runnable jobs, and tracks state transitions through success and failure.

    Data Structure Designstate-machinedependency-graphconcurrencysystem-design
  • Data Structure DesignMediumModel answer
    Design a Formula Engine with Cycle Detection

    Build a computation system where cells hold values or formulas referencing other cells, detecting circular dependencies before they corrupt state.

    Data Structure Designgraphstopological-sortcycle-detection
  • Data Structure DesignMediumModel answer
    Build a Tree System with LRU Cache and Command History

    Design a data structure for a tree where nodes can be read, modified, and traversed, with an LRU cache for fast access and an undo stack for reverting changes.

    Data Structure Designlru-cachetree-traversalcommand-patternundo-redo
  • Data Structure DesignMediumModel answer
    Design a Shopping Cart with OOP: Catalog, Lines, and Totals

    Model a shopping cart in object-oriented code: add, update, and remove items, compute an exact total, and handle edge cases consistently.

    Data Structure Designobject-oriented designpythonmoney arithmetic
  • Data Structure DesignHardModel answer
    Memoization Cache: Key Design and Write-Ahead Log Recovery

    Build a Python LRU memoization cache with correct argument-key normalization, then add crash recovery via an append-only log with torn-write handling.

    Data Structure Designlru-cachememoizationcrash-recoverywrite-ahead-log
  • Data Structure DesignMediumModel answer
    Build a List with a Tracking Cursor

    Design a mutable list with a cursor that stays attached to its element as items are inserted, removed, or relocated within the collection.

    Data Structure Designdata-structuresinvariantsapi-designcomplexity-analysis
  • Data Structure DesignHardModel answer
    In-Memory Transaction Ledger with Aliases and History

    Implement a timestamped in-memory ledger supporting deposits, cashback transfers, scheduled execution, account merging with alias resolution, and point-in-time balance queries.

    Data Structure Designunion-findheapbinary-searchsimulation
  • Data Structure DesignMediumModel answer
    Constant-Time Range Queries and Stack with Maximum Tracking

    Implement two data structures: one supporting fast interval sum queries on a fixed array, and a stack that efficiently tracks and removes its maximum element.

    Data Structure Designprefix-sumstackheapdata-structures
  • Data Structure DesignMediumModel answer
    Maintaining a Random Sample from a Stream of Unknown Length

    Implement a data structure that keeps k randomly chosen items from a stream where you don't know the total count ahead of time.

    Data Structure Designreservoir-samplingstreaming-algorithmsrandomized-algorithms
  • Data Structure DesignMediumModel answer
    Queue Abstraction Design with Multiple Backing Structures

    Design a queue interface and implement it using different data structures, analyzing trade-offs between linked lists, arrays, and stacks.

    Data Structure Designobject-oriented-designdata-structurestrade-offs
  • Data Structure DesignMediumModel answer
    Two-Player Grid Battle: Terminal Ship Placement and Combat

    Build a complete terminal game where two players secretly place ships on grids, then take turns firing until one fleet is destroyed.

    Data Structure Designobject-oriented-designgame-logicinput-validationstate-management
  • Data Structure DesignEasyModel answer
    Build an Event Dispatcher with Subscribe and Notify Operations

    Design and implement a subscription-based event system where functions can subscribe to event identifiers and be invoked when those events are triggered.

    Data Structure Designevent-systemcallbackserror-handlingreentrancy
  • Data Structure DesignMediumModel answer
    Build a Thread-Safe Batched Log Writer

    Create a logger that safely accepts messages from multiple threads, buffers them in memory, and writes batches to disk based on size or time triggers.

    Data Structure Designconcurrencythreadingproducer-consumerbuffering
  • Data Structure DesignHardModel answer
    Amusement Park Tap-to-Ride: Credits, Surcharges, and Refunds

    Simulate a wristband payment system that drains expiring credits before a linked card, applies zone-based surcharges, and splits refunds back across both funding sources.

    Data Structure Designsimulationpriority-queuestate-management