KatInterview

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

Data Structure Design Interview Problems

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

5978
Problems
2214
Auto-graded
15
Topics
272
Added today

Showing 181–210 of 738 results

  • Data Structure DesignMediumModel answer
    Photo Slideshow with Ranked Comment Threads and Safe Voting

    Design a slideshow widget plus per-photo comment threads with idempotent voting and fast top-k ranking, scaling to 10^5 photos and 10^6 comments.

    Data Structure Designdata-structure-designsorted-indexidempotencypagination
  • Data Structure DesignEasyModel answer
    Python Tuples, Dict Internals, and Error Handling in a Record Store

    Answer three fundamentals questions: tuple rebinding and shallow immutability, how a hash table handles insert, lookup, update and delete, and where to raise and catch errors in a record class.

    Data Structure Designpythonimmutabilitytupleshash-table
  • Data Structure DesignMediumAuto-graded
    Earliest Non-Repeating ID in a Live Feed Replay

    Replay a sequence of operations on a stream of integer IDs and report, at each query, the earliest-arriving ID seen exactly once, using a hash map plus an ordered queue.

    Data Structure Designhash-mapqueuedesignstreaming
  • Data Structure DesignMediumAuto-graded
    Batch Autocomplete Lookup Over a Dictionary of Words

    Answer many prefix queries against a word list, returning sorted distinct matches for each, using sorting and binary search or a trie instead of rescanning the list per query.

    Data Structure Designbinary-searchtriesortingstrings
  • Data Structure DesignMediumModel answer
    Coalescing Single-Key Reads into Timed Batch Requests

    Build a callback-driven client that gathers individual key requests into one batched GET every 100 ms, using only a timer and an async HTTP primitive, while keeping overlapping batches isolated.

    Data Structure Designevent-loopbatchingcallbackstimers
  • Data Structure DesignEasyAuto-graded
    Log Event Processor with Time Order

    Tests data structure management and stable sorting to process out-of-order time-stamped events while preserving insertion order for ties.

    Data Structure Designsortingdata-structuresdesign
  • Data Structure DesignMediumAuto-graded
    Rate-Limited Dispatcher: Which Requests Fire and When

    Simulate a rate limiter with a fixed lockout window that keeps only the newest waiting request, using event-driven processing and a precise rule for requests landing exactly at window end.

    Data Structure Designsimulationevent-driventhrottletwo-pointers
  • Data Structure DesignMediumAuto-graded
    Process LFU Cache Operations with Frequency and Recency Eviction

    Simulate a Least Frequently Used (LFU) cache supporting fast O(1) operations, breaking tie frequencies by least recent usage.

    Data Structure Designdesign-dsarrayshash-table
  • Data Structure DesignMediumAuto-graded
    Running Median Tracker Over an Operation Log

    Process a log of insert and query operations on an integer stream, returning the current median for each query, using two heaps for efficient updates.

    Data Structure Designheaptwo-heapsstreamingmedian
  • Data Structure DesignMediumAuto-graded
    Subscription Filter Matching with Ordered Delivery

    Simulate a message router that matches nested JSON events against per-queue filter policies and returns matching queues in first-subscription order.

    Data Structure Designdesignhash-mapjsonsimulation
  • Data Structure DesignMediumAuto-graded
    Path-Keyed File Store with Per-User Storage Quotas

    Simulate a command stream on an in-memory file store with admin and user-owned files, prefix/suffix search, copying, and quota-driven eviction.

    Data Structure Designhash-mapsimulationsortingdesign
  • Data Structure DesignMediumAuto-graded
    Per-User Request Throttle Simulator with Rolling Time Window

    Replay a list of throttle operations and decide, per user, whether each request fits within k accepted requests in a rolling window of t ms, using inclusive boundary rules.

    Data Structure Designsliding-windowdequehash-mapsimulation
  • Data Structure DesignMediumModel answer
    Object Model and Move Engine for a Sliding-Tile Merge Game

    Design the classes and core move algorithm for a configurable N x N sliding-tile merge puzzle, with testable randomness, win and loss detection, and room for undo.

    Data Structure Designobject-oriented-designgame-logicsimulationdependency-injection
  • Data Structure DesignMediumAuto-graded
    Word Index with Prefix Queries and Ordered Suggestions

    Simulate a command sequence on a word index that supports insert, exact lookup, prefix lookup, and alphabetically ordered, capped autocomplete, built on a trie.

    Data Structure Designtriedesigndfsstrings
  • Data Structure DesignEasyAuto-graded
    Ledger Simulator with Holds, Deferred Payments and Cancellations

    Simulate a small in-memory bank driven by a command script, covering account creation, instant and deferred transfers, batch settlement and cancellation of pending transfers.

    Data Structure Designsimulationhash-mapstate-managementclass-design
  • Data Structure DesignMediumModel answer
    Build an Expiring LRU Cache with an Injectable Clock

    Design a fixed-capacity cache with least-recently-used eviction and per-entry expiry, and justify your data structures, tests and complexity.

    Data Structure Designlru-cacheordereddictttlunit-testing
  • Data Structure DesignMediumModel answer
    How Hash Tables Handle Collisions, Deletes, and Growth

    Walk through hash table internals: index mapping, chaining versus linear probing, safe deletion, load-factor resizing, and when operations degrade from O(1) to O(n).

    Data Structure Designhash-tablecollision-resolutionlinear-probingload-factor
  • Data Structure DesignHardModel answer
    Boolean Condition Trees for a Spending Policy Checker

    Design a data-driven policy engine whose rules combine field checks with nested AND, OR and NOT, covering representation, validation, missing-field behavior and explainable results.

    Data Structure Designexpression-treerules-enginevalidationboolean-logic
  • Data Structure DesignMediumAuto-graded
    Hourly Courier Pay Ledger with Settlement Watermark

    Simulate a payroll ledger that records work intervals, tracks accrued cost, and settles wages up to a cutoff time without double-paying.

    Data Structure Designdesignsimulationintervalsidempotency
  • Data Structure DesignMediumAuto-graded
    Replay Commands on a Fixed-Bucket Key-Value Store

    Simulate a hand-built key-value store with a fixed bucket count by replaying a command log, handling collisions and overwrites correctly without a built-in dictionary.

    Data Structure Designhash-tableseparate-chainingsimulationdesign
  • 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 DesignMediumAuto-graded
    Ticket Ranges: Find the Bucket Owning Each Draw

    Map integer draws to the index whose cumulative weight range contains them, using prefix sums and binary search, driven through a batch of init/query operations.

    Data Structure Designprefix-sumbinary-searchdesignbisect
  • Data Structure DesignMediumAuto-graded
    Closest Pair Gaps Between Words in a Fixed List

    Answer many closest-index-distance queries over a fixed word list by building a position index, precomputing same-word gaps, and binary searching the smaller list.

    Data Structure Designinverted-indexbinary-searchpreprocessinghash-map
  • 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 DesignMediumAuto-graded
    Failure Streaks and Fix Times from a Live Test Log

    Process a stream of pass/fail log operations, answering shortest-fix-time and longest-concurrent-failure-window queries with an incremental, level-based data structure.

    Data Structure Designdesignstreamingintervalshash-map
  • Data Structure DesignMediumAuto-graded
    Replay Operations on a Fixed-Size Ring Buffer Queue

    Simulate a fixed-capacity circular FIFO queue from an operation log, handling wraparound, full and empty states, and logical index lookups in constant time per operation.

    Data Structure Designcircular-queuering-buffersimulationdesign
  • 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 DesignHardAuto-graded
    Simulate LFU Cache Sequence

    Process a series of LFU cache queries with LRU tie-breaking and track the output of each operation.

    Data Structure Designhash-tablelinked-listdesignlfu-cache