KatInterview

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

Data Structure Design Interview Problems

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

5974
Problems
2212
Auto-graded
15
Topics
269
Added today

Showing 601–630 of 737 results

  • 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 DesignMediumAuto-graded
    Simulate a Nested Tic-Tac-Toe Game with Board-Routing Rules

    Tests state management for a two-layer game board with recursive win detection and dynamic move constraints based on previous plays.

    Data Structure Designsimulationgame-theorystate-machine
  • Data Structure DesignMediumAuto-graded
    Duplicate Linked List and Simulate LRU Cache Operations

    Tests linked list deep copying with arbitrary pointers and implementing an LRU cache with O(1) operations using hash maps and doubly-linked lists.

    Data Structure Designlinked-listshash-mapdesignpointers
  • 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 DesignEasyAuto-graded
    Simulate a Bounded LRU Cache with Get/Put Operations

    Tests the ability to simulate a fixed-capacity LRU cache by processing a sequence of get/put operations and collecting all get results in order.

    Data Structure Designdata structurescachesimulation
  • 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 DesignMediumAuto-graded
    Key-Value Store Operation Simulator

    Tests ability to use hash maps for constant-time operations and handle state transitions in a key-value store simulation.

    Data Structure Designhash-mapsimulationdata-structures
  • Data Structure DesignMediumAuto-graded
    Historical Key-Value Store with Time-Based Retrieval

    Tests your ability to build a versioned data store supporting efficient historical lookups through binary search on sorted timestamps.

    Data Structure Designbinary-searchhash-mapdata-structures
  • 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 DesignHardAuto-graded
    Sliding-Window Event Counter with a Circular Bucket Buffer

    Design a fixed-memory event counter using a ring buffer of per-second buckets that tracks how many events fell inside a trailing 15-minute window.

    Data Structure Designring-buffersliding-windowdesignsimulation
  • 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 DesignMediumAuto-graded
    Cart History: Undo and Redo Item Changes

    Design a cart with reversible add/remove operations, tracking change history with undo/redo stacks.

    Data Structure Designdata-structuresstackstate-management
  • Data Structure DesignMediumAuto-graded
    Hierarchical Resource Tree Operations

    Tests tree manipulation with parent-child relationships, path reconstruction, and cycle prevention during node relocation.

    Data Structure Designtreeshash-mapsgraphscycle-detection
  • Data Structure DesignMediumAuto-graded
    Process Event Listener Operations

    Tests understanding of the observer pattern through ordered listener management, callback registration/removal, and event dispatch simulation.

    Data Structure Designobserver-patterndata-structuresstate-management
  • Data Structure DesignHardAuto-graded
    Live String Index Store with Closest-Match Queries

    Tests ability to design a data structure that supports streaming character appends, point updates, and O(log N) nearest-occurrence queries over a mutable string.

    Data Structure Designordered-settreapbinary-search-treedesign
  • Data Structure DesignHardAuto-graded
    Simulate a Time-Aware Key-Value Store with Transactions

    Tests implementation of an in-memory store combining TTL expiration, a logical clock, and atomic single-transaction semantics with rollback.

    Data Structure Designhash-maptransactionssimulation
  • Data Structure DesignEasyAuto-graded
    Sliding Window Hit Counter

    Tests ability to design time-windowed event counters with efficient memory management and query performance using sliding-window techniques.

    Data Structure Designqueuesliding-windowdata-structure-design
  • Data Structure DesignHardAuto-graded
    Multi-Consumer Iterator with Shared Buffering

    Tests iterator protocols, lazy evaluation, and memory-efficient buffering for multiple independent consumers reading from a single source stream.

    Data Structure Designiteratorsgeneratorsmemory-management
  • Data Structure DesignMediumAuto-graded
    Batch Counter Updates with Global Shift and Min Extraction

    Tests lazy global offset propagation and min-heap with lazy deletion to efficiently manage counters under bulk increments and minimum extraction.

    Data Structure Designheaplazy-propagationdesign
  • Data Structure DesignMediumAuto-graded
    Running Median Tracker with Dual-Heap Design

    Tests the ability to maintain an efficient two-heap structure that yields the current median of a growing integer stream in O(log n) per insertion and O(1) per query.

    Data Structure Designheaptwo-heapsdata-streammedian
  • Data Structure DesignMediumAuto-graded
    Simulate Least-Recently-Used Cache Operations

    Tests your ability to implement a data structure that maintains access order and performs lookups, updates, and evictions efficiently.

    Data Structure Designhash-maplinked-listcacheordered-dict
  • Data Structure DesignMediumAuto-graded
    Contiguous Block Allocator with Tag-Based Memory Management

    Tests segment tree design for efficiently finding and tracking contiguous free blocks in a memory-like array with logarithmic-time allocation and release operations.

    Data Structure Designsegment-treeinterval-managementdata-structure-design
  • Data Structure DesignMediumAuto-graded
    Replay Operations on a Bounded LRU Cache

    Tests understanding of least-recently-used eviction by executing a sequence of cache operations and collecting their return values.

    Data Structure Designcachelruevictionsimulation
  • 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
  • Data Structure DesignMediumAuto-graded
    Versioned Social Graph: Follow, Snapshot, and Recommend

    Tests data-structure design for a directed follow graph with copy-on-snapshot history and friend-of-friend recommendations ranked by mutual count.

    Data Structure Designhash-mapsimulationdesign
  • Data Structure DesignMediumModel answer
    Build a Fox-and-Geese Turn-Based Grid Game Engine

    Model the board state, movement rules, and win conditions for an asymmetric two-player grid game where geese try to reach the far side while foxes hunt them.

    Data Structure Designobject-oriented designgame enginesimulationstate machine
  • Data Structure DesignHardModel answer
    Tiered Cache Manager with Expiry and Weighted Retrieval

    Implement a multi-level cache that evicts expired entries, checks tier utilization, and retrieves the highest-weight item from any eligible tier.

    Data Structure Designheaplazy-deletionmulti-levelexpiration