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 362 results

  • Data Structure DesignMediumModel answer
    Build a CSR Container and Multiply It by a Dense Vector

    Design a class that compresses a mostly-zero integer matrix into three CSR arrays, then use it to compute a matrix-vector product in time proportional to the non-zero count.

    Data Structure Designsparse-matrixcsrmatrix-vector-multiplicationdata-structure-design
  • Data Structure DesignMediumModel answer
    Build a Polite Web Crawler with Letter-Coverage Ordering

    Design and implement a rate-limited article crawler that visits pages with unseen first letters before switching to random order, and explain how you would use an AI assistant to build it.

    Data Structure Designweb-crawlerrate-limitingfrontier-designai-pairing
  • Data Structure DesignHardModel answer
    Bank Ledger with Holds, Expiring Transfers and Customer Merge

    Build an in-memory bank that supports deposits, payments, two-step transfers with expiring holds, a top-activity ranking, and customer merges that leave history untouched.

    Data Structure Designobject-oriented-designhash-mapheaplazy-expiry
  • Data Structure DesignMediumModel answer
    Build a Minesweeper Engine That Scales to Huge Sparse Grids

    Design a Minesweeper class with board rendering and click handling via flood fill, then adapt it to enormous boards with few mines using lazy state and on-demand counting.

    Data Structure Designdesignflood-fillbfssparse-data-structures
  • Data Structure DesignMediumModel answer
    What Java's volatile Does and Does Not Guarantee

    Explain the Java Memory Model guarantees of volatile fields: visibility, happens-before ordering and reordering limits, its gaps such as compound atomicity, and when to prefer locks or atomics.

    Data Structure Designjavaconcurrencymemory-modelvolatile
  • Data Structure DesignHardModel answer
    Append-Only Log Storage Engine with Torn-Write Recovery

    Build an embedded byte-oriented key-value store on a checksummed append-only log, with an in-memory index, delete markers, thread safety and recovery that truncates a damaged tail.

    Data Structure Designstorage-engineappend-only-logcrash-recoverycrc32
  • Data Structure DesignMediumModel answer
    Design a Concurrent Fixed-Size Thread Pool with Task Futures

    Design and implement a fixed-size thread pool with safe task queueing, future result retrieval, exception handling, and graceful or forced shutdown mechanism using basic locks and condition variables.

    Data Structure Designconcurrencythread-pooldesignmultithreading
  • Data Structure DesignMediumModel answer
    Build a Quiet-Period Call Delayer in JavaScript

    Write a higher-order function that postpones a callback until calls have stopped for a given time, preserving this and arguments, and discuss cancel, flush and leading-edge variants.

    Data Structure Designjavascriptclosurestimersdebounce
  • Data Structure DesignMediumModel answer
    Build a Single-Use Password Reset Token Manager

    Design an in-memory service that issues reset tokens, enforces expiry and a failed-attempt cap, rejects reused passwords, and makes each token usable only once.

    Data Structure Designstate-machinehash-mapauthenticationttl-expiry
  • Data Structure DesignMediumModel answer
    Repair a Faulty LRU Cache and Add Crash-Safe Persistence

    Find and fix the bugs in a broken fixed-capacity LRU cache, then make its acknowledged writes survive a crash using an append-only log, snapshots and atomic file replacement.

    Data Structure Designlru-cachedebuggingwrite-ahead-logcrash-recovery
  • Data Structure DesignMediumModel answer
    Thread-Safe Kitchen: Cook-Once, Pickup-Once Order Pipeline

    Build a thread-safe kitchen where producers place orders, chefs cook them, and customers block until their dish is ready, with no races, deadlocks, or busy-waiting.

    Data Structure Designconcurrencycondition-variableblocking-queuethread-safety
  • Data Structure DesignMediumModel answer
    Time-Travel Key-Value Store with Point-in-Time Snapshots

    Design a hash-map-backed store that records every write with an increasing timestamp, answers reads as of any past moment, and exports a frozen plain-map snapshot.

    Data Structure Designhash-mapbinary-searchversioningsnapshot
  • Data Structure DesignMediumModel answer
    Streaming Reader for a Page-Based Word Source

    Build a class that wraps a slow, paginated word API and serves exact word counts per call, keeping leftovers between calls and fetching pages lazily.

    Data Structure Designclass-designbufferingpaginationdeque
  • Data Structure DesignMediumModel answer
    Build a Thread-Safe Cart with Pluggable Promotions

    Design an in-memory shopping cart with exact money arithmetic, strategy-based promotions, an itemized receipt, and safe concurrent updates.

    Data Structure Designobject-oriented-designstrategy-patternvalue-objectconcurrency
  • Data Structure DesignMediumModel answer
    Build a Type-Ahead Catalog Lookup with Cancellation and Caching

    Build an accessible type-ahead lookup that delays requests, discards outdated responses, remembers past queries, supports keyboard control, and copes with errors.

    Data Structure Designfrontendreactdebounceabortcontroller
  • Data Structure DesignEasyModel answer
    Dismiss-Then-Navigate: A Browser Notice Helper in Plain JS

    Write a vanilla JavaScript function that shows a message to the user and moves the page to a given address once the message is closed, skipping the move when the address is not a non-empty string.

    Data Structure Designjavascriptdombrowser-apisevent-handling
  • Data Structure DesignMediumModel answer
    Build a Layered In-Memory Work Tracker with Quotas and Deadlines

    Design an in-memory work tracker in four growing stages: CRUD, name and priority queries, per-user limits with timed assignments, then completion and lateness reports.

    Data Structure Designdesignin-memoryhash-mapsorting
  • Data Structure DesignMediumModel answer
    Design a Thread-Safe Log Rotating Sink

    Implement a thread-safe, size-bounded rotating file sink class adhering to Liskov substitution and Python context manager protocols.

    Data Structure Designobject-oriented-designconcurrencyfile-iopython
  • Data Structure DesignHardModel answer
    Build a Scalable Memory-Constrained API Ingestion Pipeline

    Ingest, normalize, filter, and stream-sort paginated API data under memory constraints with exponential backoff and rate limiting.

    Data Structure Designpaginationrate-limitingexternal-sortdata-engineering
  • Data Structure DesignMediumModel answer
    Interleaved Dual-Thread Sequencer

    Coordinate two concurrent threads to output consecutive integers from 1 to n in strictly alternating parity order.

    Data Structure Designconcurrencythreadingsynchronizationmutex
  • Data Structure DesignMediumModel answer
    Spot the Slicing and Double-Free Bugs in a C++ Buffer Hierarchy

    Review a C++ class hierarchy that owns a raw heap buffer, explain why passing it by value breaks it, and rewrite it with modern ownership and correct polymorphic dispatch.

    Data Structure Designcppraiirule-of-fiveobject-slicing
  • Data Structure DesignHardModel answer
    Payment Command Parser and Lifecycle State Machine Design

    Design a parser for fixed-arity payment commands and an object-oriented lifecycle state machine, and identify which business rules need clarification before implementation.

    Data Structure Designstate-machineparsingobject-oriented-designvalidation
  • Data Structure DesignHardModel answer
    Variable-Argument Functions Across Languages, with a Safe Logger

    Compare how two languages implement functions with a variable number of arguments, then design a type-checked key-value logger that avoids injection and needless allocation.

    Data Structure Designvariadic-functionstype-safetycalling-conventionslogging
  • Data Structure DesignMediumModel answer
    Multi-Device Login Burst Detector over a Late-Tolerant Stream

    Design a streaming detector that flags users with 4 or more distinct devices logging in successfully within 10 minutes, tolerating events up to 30 seconds late, with bounded memory.

    Data Structure Designsliding-windowstreamingwatermarkordered-map
  • Data Structure DesignMediumModel answer
    Build a Terminal Block-Stacking Game Engine

    Design a testable, terminal-friendly engine for a falling-block puzzle on a 10x20 grid, covering movement, rotation, gravity, locking, line clearing and game over.

    Data Structure Designgame-logicstate-machinesimulationobject-oriented-design
  • Data Structure DesignMediumModel answer
    Building a Multi-Level Credit Ledger with Timed Transfers and Merges

    Build an in-memory ledger of credit-holding workspaces in four stages: transfers with a top-k ranking, timed transfers with cancellation, workspace merges, and point-in-time balance lookups.

    Data Structure Designclass-designheapbinary-searchsimulation
  • Data Structure DesignMediumModel answer
    Prefix-Caching Transform Runner with Single-Flight and LRU

    Build a thread-safe runner for chains of deterministic byte transforms that reuses cached prefixes, collapses concurrent duplicate work into one execution, and bounds memory with LRU eviction.

    Data Structure Designconcurrencylru-cachehashingsingle-flight
  • Data Structure DesignMediumModel answer
    Build a Sampler That Picks Items in Proportion to Mutable Weights

    Design a structure holding items with positive integer weights that supports insert, delete and a weight-proportional random pick, each in logarithmic time.

    Data Structure Designfenwick-treeweighted-samplingrandomizationdata-structure-design
  • Data Structure DesignMediumModel answer
    Dealing and Ranking Three-Card Hands With an Extensible Rule Set

    Build a small card game that deals three cards per player from one deck, ranks hands by category, picks the winner, then extend the ranking with a suit-based category.

    Data Structure Designobject-oriented-designsimulationcomparisonextensibility
  • Data Structure DesignMediumModel answer
    Searchable Dropdown Input with Live Async Suggestions in React

    Implement a React search box whose dropdown fills with suggestions from an abortable async source and works fully by keyboard and mouse, without ever showing outdated results.

    Data Structure Designreacthooksasyncaccessibility