KatInterview

Topic

Data Structure Design interview problems

Caches, iterators, rate limiters and custom containers. 737 original problems, each with hidden test cases you can run in the browser.

Problems737

53 easy587 medium97 hard

Showing 601–630 of 737 results

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

    Model answerdata-structuresinvariantsapi-designcomplexity-analysis
  • Tests state management for a two-layer game board with recursive win detection and dynamic move constraints based on previous plays.

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

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

    Model answerunion-findheapbinary-searchsimulation
  • 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.

    Model answerprefix-sumstackheapdata-structures
  • 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.

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

    Model answerreservoir-samplingstreaming-algorithmsrandomized-algorithms
  • Tests ability to use hash maps for constant-time operations and handle state transitions in a key-value store simulation.

    Auto-gradedhash-mapsimulationdata-structures
  • Tests your ability to build a versioned data store supporting efficient historical lookups through binary search on sorted timestamps.

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

    Model answerobject-oriented-designdata-structurestrade-offs
  • 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.

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

    Model answerobject-oriented-designgame-logicinput-validationstate-management
  • Design a cart with reversible add/remove operations, tracking change history with undo/redo stacks.

    Auto-gradeddata-structuresstackstate-management
  • Tests tree manipulation with parent-child relationships, path reconstruction, and cycle prevention during node relocation.

    Auto-gradedtreeshash-mapsgraphscycle-detection
  • Tests understanding of the observer pattern through ordered listener management, callback registration/removal, and event dispatch simulation.

    Auto-gradedobserver-patterndata-structuresstate-management
  • 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.

    Auto-gradedordered-settreapbinary-search-treedesign
  • Tests implementation of an in-memory store combining TTL expiration, a logical clock, and atomic single-transaction semantics with rollback.

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

    Auto-gradedqueuesliding-windowdata-structure-design
  • Tests iterator protocols, lazy evaluation, and memory-efficient buffering for multiple independent consumers reading from a single source stream.

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

    Auto-gradedheaplazy-propagationdesign
  • 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.

    Auto-gradedheaptwo-heapsdata-streammedian
  • Tests your ability to implement a data structure that maintains access order and performs lookups, updates, and evictions efficiently.

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

    Auto-gradedsegment-treeinterval-managementdata-structure-design
  • Tests understanding of least-recently-used eviction by executing a sequence of cache operations and collecting their return values.

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

    Model answerevent-systemcallbackserror-handlingreentrancy
  • 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.

    Model answerconcurrencythreadingproducer-consumerbuffering
  • 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.

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

    Auto-gradedhash-mapsimulationdesign
  • 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.

    Model answerobject-oriented designgame enginesimulationstate machine
  • Implement a multi-level cache that evicts expired entries, checks tier utilization, and retrieves the highest-weight item from any eligible tier.

    Model answerheaplazy-deletionmulti-levelexpiration

More topics