KatInterview

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

Data Structure Design Interview Problems

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

5967
Problems
2210
Auto-graded
15
Topics
272
Added today

Showing 31–60 of 737 results

  • Data Structure DesignMediumAuto-graded
    RLE Vector Dot Product and Execution Log Processor

    Compress sparse sequences into run-length encodings, calculate their dot product, and analyze nested call timestamps using a call stack.

    Data Structure Designarraysstackstwo-pointersdesign-ds
  • Data Structure DesignMediumAuto-graded
    Implement a Timed Workspace Credit System

    Process a sequence of timestamped operations managing workspace balances, immediate transfers, scheduled/cancelled future transfers, and ranked queries.

    Data Structure Designheaps-sortingdesign-dsarrays
  • Data Structure DesignMediumAuto-graded
    Spaced Points Stream: Cancel a Nearby Point or Insert

    Maintain a dynamic ordered set of numbers and, per arrival, find the smallest stored value in a closed window around it, deleting it or inserting the newcomer.

    Data Structure Designordered-setbalanced-bstbinary-searchstreaming
  • Data Structure DesignMediumAuto-graded
    Trade Join With Expiring Partial Records

    Simulate a stream join that pairs order and price events by ID, using a min-heap with lazy deletion to expire unmatched partial records.

    Data Structure Designhash-mapheapsimulationstream-processing
  • Data Structure DesignMediumModel answer
    Turn-Based Squad Combat Engine with Deterministic Ordering

    Simulate a fight between two squads of monsters with fixed turn order, weakest-first targeting and a damage formula, and return the ordered list of attack events.

    Data Structure Designsimulationobject-oriented-designsortingtie-breaking
  • Data Structure DesignMediumAuto-graded
    Ranking Frequent Event Names Within a Time Window

    Simulate a stream of timestamped log events and answer window queries for the k most frequent messages, with ties broken alphabetically, using binary search over a sorted log.

    Data Structure Designdesignbinary-searchhash-mapsorting
  • Data Structure DesignHardModel answer
    Thread-Safe In-Memory Store and Sliding-Window Counter

    Find the concurrency bugs in an in-memory key-value store with expiry and a 300-second hit counter, then fix them with appropriate locking and describe how to test.

    Data Structure Designconcurrencyrace-conditionslockingthread-safety
  • Data Structure DesignMediumAuto-graded
    Article Reaction Ledger with Recent Reversal Log

    Simulate a stream of up/down/clear reactions on articles, maintaining net scores and a bounded log of the three most recent reversals per article, all in constant time per operation.

    Data Structure Designhash-mapdequesimulationstate-tracking
  • Data Structure DesignMediumModel answer
    Build a Grouped, Promo-Aware, Sorted Receipt Printer

    Extend a cart class that turns scanned item names into a receipt: itemized total, grouping by type, a buy-three-get-two-free deal, then alphabetical ordering.

    Data Structure Designobject-oriented-designhash-maprefactoringmoney-arithmetic
  • Data Structure DesignMediumModel answer
    Layered REST API for Text Condensing with FastAPI

    Design a small FastAPI service that accepts text, returns a placeholder-generated summary, validates input, handles errors, and keeps a bounded in-memory history, using clear layers.

    Data Structure Designfastapipythonpydanticrest-api
  • Data Structure DesignEasyModel answer
    Resolving Name Clashes Across Two Python Parent Classes

    Predict which inherited method runs when a class has two parents defining the same method name, and explain Python's lookup order, super() cooperation, and alternatives.

    Data Structure Designpythoninheritancemroc3-linearization
  • Data Structure DesignEasyAuto-graded
    Running Tally per Label from a Replayed Call Log

    Replay a log of increment calls and report, for each call, how many times its key has appeared so far, testing hash map counting and a simple operation-dispatch design.

    Data Structure Designhash-mapsimulationdesigncounting
  • Data Structure DesignMediumModel answer
    Design an Audio Player Core with Queue Management and Shuffle Logic

    Architect the object-oriented structure and state machine for a media player featuring play/pause controls, queue prioritization, looping modes, and deterministic shuffle handling.

    Data Structure DesignObject-Oriented DesignState MachineData Structure Design
  • Data Structure DesignMediumAuto-graded
    Fixed-Size Ring Buffer Command Simulator

    Simulate a bounded FIFO ring buffer driven by a list of commands, handling wrap-around, full and empty states, and returning each command's result in order.

    Data Structure Designdesignqueuering-buffersimulation
  • Data Structure DesignMediumModel answer
    Build a Playing-Card Deck with Fair Shuffle and Custom Sort

    Model a 52-card deck, return an unbiased random permutation, and list the cards in a defined rank-then-suit order, with data structures and complexity explained.

    Data Structure Designobject-oriented-designshufflefisher-yatessorting
  • Data Structure DesignMediumAuto-graded
    Expense Reimbursement Ledger Simulator

    Simulate an expense tracking ledger executing sequential API calls with validation and error checks.

    Data Structure Designdesign-dsarrayshash-table
  • Data Structure DesignMediumAuto-graded
    Nested Undo-Log Session Store with Value Tallies

    Simulate an in-memory key-value store with nested transactions, a global commit, and a live per-value key tally, processing a batch of operations and returning each result.

    Data Structure Designhash-mapundo-logtransactionssimulation
  • Data Structure DesignEasyModel answer
    Fleet Command Console for Grid-Walking Robots

    Design a text-driven controller that manages several robots on an unbounded grid, handling turns, steps, selection, error cases and cell collisions.

    Data Structure Designsimulationhash-mapcommand-parsingstate-machine
  • Data Structure DesignMediumAuto-graded
    Simulate an Expiring Key-Value Store with Read-Through Loads

    Simulate a time-aware key-value store with expiry, stale entries that stay stored, and a read-through fetch whose loader outcome is given as data, with strict input validation.

    Data Structure Designsimulationhash-mapcachevalidation
  • Data Structure DesignMediumAuto-graded
    Canvas Replay with Undo and Redo History

    Simulate a pixel canvas with draw, erase, flood fill, undo and redo, returning a canvas snapshot after every command while keeping the history stacks consistent.

    Data Structure Designstacksimulationflood-fillundo-redo
  • Data Structure DesignMediumModel answer
    Build a Weighted Hash Ring for Sharding Keys Across Servers

    Design a hash ring with weighted virtual nodes that assigns keys to servers, supports adding and removing servers with little key movement, and handles collisions and concurrency.

    Data Structure Designconsistent-hashingvirtual-nodesbinary-searchthread-safety
  • Data Structure DesignMediumAuto-graded
    Point-in-Time Set Views from an Operation Log

    Simulate a set that processes add, remove, contains and snapshot operations, where each snapshot must be an independent frozen copy of the set at that moment.

    Data Structure Designdesignhash-setsnapshotsimulation
  • Data Structure DesignMediumAuto-graded
    Simulate a Fixed-Size Cache Under LRU or LFU Eviction

    Replay a list of get/put operations on a bounded cache that evicts by recency or by frequency (ties broken by recency), and return the result of each operation.

    Data Structure Designhash-mapordered-dictlrulfu
  • Data Structure DesignMediumModel answer
    Function Composition Twice and Core Container Cost Comparison

    Write a helper that feeds a function's output back into itself, explain closures and side effects, then compare arrays, linked lists, stacks and queues by operation cost.

    Data Structure Designhigher-order-functionsclosuresside-effectscomplexity-analysis
  • Data Structure DesignMediumAuto-graded
    Ring-Buffer Deque with Constant-Time Indexing

    Build a double-ended queue on a resizable circular array so index lookups are O(1), then replay a command list against it and report each result.

    Data Structure Designcircular-bufferdequedynamic-arrayamortized-analysis
  • Data Structure DesignMediumAuto-graded
    Simulate Stacked Rectangles on a Small Text Canvas

    Simulate add, remove, reorder and render commands on a layered character canvas, resolving overlaps by layer order and clipping shapes at the edges.

    Data Structure Designsimulationordered-dictdesignclipping
  • Data Structure DesignMediumAuto-graded
    Log Record Dedup: Batch Merge and Watermarked Replay

    Deduplicate log records by event id under a first or latest policy, then replay an operation list through a watermark-based stream deduplicator that drops late data and evicts finalized entries.

    Data Structure Designhash-mapsortingstreamingwatermark
  • Data Structure DesignMediumModel answer
    Build a Fire-Once Event Gate for Concurrent Threads

    Design a thread-safe one-shot event gate with fire, timed wait and non-blocking status check, avoiding lost wakeups, spurious-wakeup bugs and busy-waiting.

    Data Structure Designconcurrencycondition-variablethreadingsynchronization
  • Data Structure DesignMediumModel answer
    Weighted Random Picker with Live Weight Updates

    Build a container that returns items at random with probability proportional to their weights, supports re-weighting existing items, and keeps picks fast and memory small.

    Data Structure Designfenwick-treeprefix-sumsrandom-samplingbinary-search
  • Data Structure DesignHardAuto-graded
    Credit Ledger Simulator with Merges and Delayed Rewards

    Simulate a timestamped ledger with deposits, transfers, spends with delayed cashback, account merges and spend rankings, using union-find and a min-heap.

    Data Structure Designdesignunion-findheapsimulation