KatInterview

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

Data Structure Design Interview Problems

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

5988
Problems
2219
Auto-graded
15
Topics
271
Added today

Showing 391–420 of 739 results

  • Data Structure DesignMediumAuto-graded
    Restaurant Queue Tracker with Fast Rank Lookup

    Replay a list of queue operations on a first-come waitlist, supporting add, remove-by-id, rank lookup and front peek, with rank queries faster than a linear scan.

    Data Structure Designdesignorder-statistictreaphash-map
  • Data Structure DesignMediumModel answer
    Fast Machine Selection for a Memory-Aware Table Placer

    Redesign a slow in-memory placer so it finds a machine with enough free RAM, resizes tables, and moves them quickly, while justifying a placement policy.

    Data Structure Designdata-structure-designbisectbest-fitscheduling
  • Data Structure DesignMediumAuto-graded
    Multiset Frequency Log with Lazy Snapshot Pool Top-K

    Simulate insert, remove and top-k queries on a multiset using a snapshot pool whose stale entries are discarded lazily, testing hash maps with heaps and exact rule-following.

    Data Structure Designhash-mapheaplazy-deletiondesign
  • Data Structure DesignMediumModel answer
    Timeline Lookup Store and Shared-Friend Suggestions

    Build a store that returns the latest value at or before a query time, then suggest new connections to a user based on having at least two friends in common.

    Data Structure Designbinary-searchhash-mapgraphdesign
  • Data Structure DesignMediumAuto-graded
    Closest Repeat Distance with Fast Threshold Queries

    Precompute the smallest distance between equal values in an array once, then answer many "repeat within k" and "closest repeat" queries in constant time each.

    Data Structure Designhash-mappreprocessingbatch-queriesarrays
  • Data Structure DesignMediumAuto-graded
    Simulate a Four-Seat Trick-Taking Card Game with Scoring

    Simulate a full 13-trick, four-player card game with deterministic dealing, follow-suit rules, and point scoring, and return the complete game record.

    Data Structure Designsimulationstate-managementsortinghash-map
  • Data Structure DesignMediumModel answer
    Audit a Flawed Proximity-Search Module in Python

    Review a small Python module for finding and labeling nearby places, spotting correctness, speed and design problems, then propose and justify concrete refactors.

    Data Structure Designcode-reviewpythongeospatialhaversine
  • Data Structure DesignMediumAuto-graded
    Count-Feature Text Classifier via Command Replay

    Simulate a stateful multinomial Naive Bayes model driven by fit and predict commands, using smoothed log-probabilities and a deterministic tie-break.

    Data Structure Designnaive-bayessimulationlog-probabilitiessmoothing
  • Data Structure DesignMediumAuto-graded
    Versioned Lookup Store with Inclusive Range Event Tally

    Simulate a batch of commands on a per-key timestamped value history and an event log, using binary search for point-in-time lookups and inclusive range counts.

    Data Structure Designbinary-searchhash-mapdesignsimulation
  • Data Structure DesignMediumAuto-graded
    Recency-Evicting Cache Simulator

    Simulate a fixed-capacity key-value store that evicts the least recently used entry, processing a batch of get and put commands in constant time each.

    Data Structure Designhash-mapdoubly-linked-listlru-cachesimulation
  • Data Structure DesignMediumModel answer
    Weighted Random Picker for Unbounded Integer Scores

    Build a picker that returns an item with probability proportional to its weight, even when weights and their total exceed 32-bit or 64-bit limits, and discuss precision and memory trade-offs.

    Data Structure Designrandomized-algorithmsprefix-sumbinary-searchalias-method
  • Data Structure DesignMediumModel answer
    Design a Pluggable Payroll Cost Estimator

    Design the types and API that compute an employee's full cost from salary, tax, benefits, and a signed location adjustment, with exact money math, explicit missing-rule handling, and versioned rules.

    Data Structure Designobject-modelingapi-designmoney-handlingconfiguration-versioning
  • Data Structure DesignHardModel answer
    Steady-Cadence Frame Player with Bounded Decode Buffer

    Build a thread-safe player where a decoder thread fills a bounded buffer and a render thread emits frames at a fixed rate on a monotonic clock, with clean pause, stop and underrun handling.

    Data Structure Designconcurrencyproducer-consumerthreadingscheduling
  • Data Structure DesignHardModel answer
    Build a Accessible, Controllable Select Menu in React

    Design and implement a reusable select-style menu in React with controlled and uncontrolled state, keyboard support, ARIA semantics, and a plan for production hardening.

    Data Structure Designreactfrontendaccessibilitycomponent-design
  • Data Structure DesignMediumAuto-graded
    Lifespan Lookups for Orders and Order Groups in a Replay Log

    Simulate a class through an operations list, tracking per-order and per-group start and end times so lookups run in constant time, with groups reporting 0 while any member is open.

    Data Structure Designhash-mapdesignsimulationaggregation
  • Data Structure DesignHardModel answer
    Live Portfolio Valuation Across Tag-Filtered Books

    Design a class that maintains mark-to-market profit for many tag-filtered trade groups while trades and price ticks stream in, without rescanning trade history on each update.

    Data Structure Designdesignhashingincremental-updatelazy-evaluation
  • Data Structure DesignMediumModel answer
    Minesweeper Solver: Deduction Rules and Mine Probabilities

    Design a Minesweeper bot that derives certain mines and safe cells from overlapping numbers, estimates mine probabilities when it must guess, and is evaluated by win rate.

    Data Structure Designminesweeperconstraint-satisfactionprobabilitybacktracking
  • Data Structure DesignMediumAuto-graded
    Duplicate Log Suppression Within a Cooldown Window

    Simulate a duplicate-log filter driven by an operation script, tracking per-message cooldowns where only accepted messages restart the timer.

    Data Structure Designhash-mapdesignsimulationrate-limiting
  • Data Structure DesignMediumAuto-graded
    Slide a Block in a Grid and Filter Repeated Log Calls

    Move a rectangular block inside a 2D grid without corrupting overlapping data, then run a sliding-window duplicate filter over a list of timestamps.

    Data Structure Designmatrixin-placesliding-windowdeque
  • Data Structure DesignMediumModel answer
    Singleton, Factory Method and Strategy: Code and Compare in Java

    Write Java versions of a lazy thread-safe Singleton, a Factory Method and a Strategy, weigh them against each other, then refactor a Singleton dependency to use injection.

    Data Structure Designdesign-patternsjavasingletonfactory-method
  • Data Structure DesignMediumModel answer
    In-Memory Ledger with Ranking by Total Money Sent

    Build an in-memory ledger supporting account creation, deposits and transfers, plus a query returning the top n senders by cumulative outgoing amount with deterministic tie-breaking.

    Data Structure Designdata-structure-designhash-mapheaptop-k
  • Data Structure DesignHardModel answer
    Crash-Safe Job Dispatcher with Lease Timeouts and Dependency Graphs

    Build an in-memory job dispatcher where workers hold timed leases, stale workers are fenced off, jobs form a dependency DAG, and you justify the delivery guarantees.

    Data Structure Designleasesfencing-tokensdagtopological-sort
  • Data Structure DesignMediumAuto-graded
    Per-Tab Navigation Timeline Replay

    Simulate independent per-tab navigation timelines with a cursor, supporting visit, back and forward, and replay a batch of operations to collect their results.

    Data Structure Designdesignhash-mapsimulationcursor
  • Data Structure DesignMediumModel answer
    Weighted Random Picker with Live Weight Updates

    Design a sampler that picks an index in proportion to its weight, supports weight changes, draws several distinct items, and can be seeded and tested statistically.

    Data Structure Designweighted-samplingfenwick-treeprefix-sumsbinary-search
  • Data Structure DesignHardAuto-graded
    Track Covered Spans Under Add, Erase and Check Commands

    Maintain a set of half-open real intervals under add, remove and fully-covered queries, merging touching spans and splitting spans on removal.

    Data Structure Designintervalsbinary-searchsimulationsorted-list
  • Data Structure DesignHardModel answer
    Build an Exact Usage Ledger for Chunked LLM Responses

    Design a billing ledger that merges streamed token deltas and one-shot totals, validates events strictly, and keeps all money as integer nano-USD to avoid floating-point drift.

    Data Structure Designdesign-dshash-mapvalidationstate-machine
  • Data Structure DesignMediumModel answer
    Finish a REST Resource: Update and Delete Routes in FastAPI

    Extend a small FastAPI service with replace and remove routes that follow existing conventions, handle idempotency and errors correctly, and ship with a full test suite.

    Data Structure Designfastapirest-apipydantichttp-status-codes
  • Data Structure DesignMediumModel answer
    Build a Dependency-Aware Cell Calculator with Cycle Checks

    Design an in-memory grid of numeric and formula cells in Python, reject circular dependencies, allow shared references, and compare lazy evaluation against eager recomputation with caching.

    Data Structure Designdesigngraphcycle-detectionmemoization
  • Data Structure DesignMediumAuto-graded
    Rolling Forklift Ping Counts with Late Arrivals and Shift Tracking

    Simulate a fleet telemetry service that tracks per-forklift pings in a global 15-minute window, handles late pings, and counts clocked-in forklifts.

    Data Structure Designsliding windowheaphash mapdata structure design
  • Data Structure DesignEasyAuto-graded
    Bidirectional Page Navigation with Integer Cursors

    Simulate a paginator that serves pages forward and backward from integer cursors, with correct clamping at both ends and for a short final page.

    Data Structure Designdesignpaginationsimulationarray-slicing