KatInterview

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

Data Structure Design Interview Problems

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

5976
Problems
2213
Auto-graded
15
Topics
271
Added today

Showing 181–210 of 362 results

  • Data Structure DesignMediumModel answer
    Card Prefix Registry with Per-Field Trust Resolution

    Design an in-memory registry mapping digit prefixes to brand and card type, resolving each field by longest prefix, then trust, then recency, with fast lookups.

    Data Structure Designhash-maplongest-prefix-matchtriedata-structure-design
  • 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 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 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 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 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 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 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 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 DesignMediumModel answer
    Build a Task Registry and Content-Based Duplicate Finder

    Design an in-memory task manager with per-user quotas, priority ordering and audit trails, then detect duplicate files using size filtering and streaming hashes.

    Data Structure Designhash-mapssorted-containersfilesystemhashing
  • Data Structure DesignMediumModel answer
    Build a Configurable Disc-Drop Game Engine

    Design and implement a gravity-based four-in-a-row game engine with a clean API, local win detection, and support for arbitrary board sizes and run lengths.

    Data Structure Designgame-engineapi-design2d-arraywin-detection
  • Data Structure DesignMediumModel answer
    Build a Slash-Command Router with Literal and Wildcard Segments

    Implement a trie-based router that matches tokenized bot commands to registered handlers, resolving conflicts between exact and parameterized path segments.

    Data Structure Designtrieroutingdesignstring-parsing
  • Data Structure DesignMediumModel answer
    Build a POS cart with live receipt printing and combo deals

    Design a point-of-sale cart that prints an itemized receipt on every tap and then extends to apply non-overlapping combo discounts after each update.

    Data Structure Designdata-structuressimulationgreedy
  • Data Structure DesignMediumModel answer
    Rolling-Window Key-Value Store with Live Average

    Design a key-value store that expires entries older than a configurable time window and supports O(1) average-case get, put, and average queries.

    Data Structure Designhash-maplinked-listsliding-windowamortized-analysis
  • Data Structure DesignHardModel answer
    Thread-Safe Queue with Lease-Based Message Visibility

    Design an in-memory queue that delivers messages with time-limited leases, validates acknowledgments against current lease tokens, and rejects duplicate entries.

    Data Structure Designconcurrencyqueuestate-machineidempotency
  • Data Structure DesignMediumModel answer
    Classic Data-Structure Drills: Cache, Trie, Heaps, Graphs

    Work through fifteen core algorithm patterns—LRU cache, trie, two-pointers, sliding window, topological sort, and more—naming invariants before coding.

    Data Structure Designhash-tablestwo-pointerssliding-windowgraphs
  • Data Structure DesignMediumModel answer
    Building an In-Memory Recipe Store with Search and Versioning

    Design an in-memory recipe system with CRUD, ingredient lookup, per-user attribution with sorting, and immutable version history that survives deletes.

    Data Structure Designobject-oriented-designin-memory-storeindexingaudit-history
  • Data Structure DesignHardModel answer
    In-Memory Ledger with Timed Transfers and Account Consolidation

    Design an in-memory financial ledger supporting deposits, transfers, scheduled future payments, top-K spending rankings, and account merges with pending-payment reconciliation.

    Data Structure Designheaphash-mapschedulingunion-find
  • Data Structure DesignMediumModel answer
    Design an In-Memory Ledger with Transfers and Activity Ranking

    Build an in-memory account ledger in stages—create/deposit, transfer, top-N by activity—plus a command-string test harness with clear failure semantics.

    Data Structure Designobject-oriented-designhash-mapheaptest-harness
  • Data Structure DesignMediumModel answer
    Build a Flexible Validation Engine with Pluggable Rules

    Design a payroll validator that lets you plug in new checks without changing the core engine, using abstraction and priority-based execution.

    Data Structure Designobject-oriented-designdesign-patternsextensibility
  • Data Structure DesignMediumModel answer
    Bits, Cache Eviction, and Vertex Degrees: Fundamentals Under Pressure

    Explain two's-complement shifts, compare LRU vs LFU eviction with trade-offs, and derive in-degree query costs across graph representations.

    Data Structure Designbit-manipulationcachinggraphscomplexity
  • Data Structure DesignMediumModel answer
    Build a Bank, Validate Passwords, and Evaluate Expressions

    Design a mini banking system, write a password strength checker with generator, and parse arithmetic expressions with full operator precedence.

    Data Structure Designhash-mapstackparsingsimulation