KatInterview

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

Data Structure Design Interview Problems

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

5969
Problems
2211
Auto-graded
15
Topics
273
Added today

Showing 61–90 of 737 results

  • Data Structure DesignMediumAuto-graded
    Expiring Key-Value Store Driven by a Virtual Clock

    Simulate a key-value store with per-key expiry on a manual clock, handling overwrites, deletes and cleanup of expired entries via a command list.

    Data Structure Designdesignhash-mapheapttl
  • Data Structure DesignMediumModel answer
    Build a Wildcard-Aware URL Router with Literal Priority

    Design a router that stores path templates with {name} wildcards and resolves concrete paths to a handler plus captured values, preferring exact segments and backtracking when they dead-end.

    Data Structure Designtriebacktrackingroutingstring-parsing
  • Data Structure DesignHardModel answer
    In-Memory Bank With Delayed Payments, Cancellation and Spend Ranking

    Extend an in-memory bank with delayed payments that can be canceled, record success or failure for each, discard stale entries, and rank accounts by total outgoing money.

    Data Structure Designdesign-dsheaplazy-deletionsimulation
  • Data Structure DesignMediumAuto-graded
    Replay a Sequence of Recency-Evicting Cache Commands

    Simulate a fixed-capacity cache that evicts the least recently used entry, replaying a list of get/put commands and returning each command's result.

    Data Structure Designlru-cachehash-maplinked-listsimulation
  • Data Structure DesignMediumModel answer
    Upgrade a Streaming Log Filter to Multi-Code and JSON Output

    Refactor a small Python log-counting script so it filters on several status codes, optionally writes JSON, streams multi-gigabyte files in constant memory, and stays unit-testable.

    Data Structure Designpythonrefactoringstreamingcli
  • Data Structure DesignMediumAuto-graded
    Batch Simulator for a TTL-Aware Name Lookup Service with Aliases

    Simulate a batch of record insertions and lookups with normalized names, TTL expiry, alias-chain following, cycle and hop-limit detection, and A/alias exclusivity.

    Data Structure Designhash-mapsimulationdesignstring-normalization
  • Data Structure DesignMediumAuto-graded
    Live Complement Counting with Point Updates on One Array

    Answer repeated target-sum pair-count queries over two integer arrays while the second array receives point updates, using frequency maps.

    Data Structure Designhash-mapfrequency-countcounting-pairssimulation
  • Data Structure DesignMediumAuto-graded
    Ranked Staff Roster Across Multiple Forums with Swap-Down

    Simulate a batch of operations on per-forum ordered staff lists, enforcing seniority rules for adding, moving down one place, and removing members.

    Data Structure Designdesignhash-mapsimulationordered-list
  • Data Structure DesignMediumModel answer
    Build a Heap Allocator with Fit Policies and Safe Handles

    Design a simulated memory manager over a fixed address range that supports two placement policies, splitting, merging of neighbors, and rejection of stale or forged release requests.

    Data Structure Designmemory-allocatorlinked-listhash-mapcoalescing
  • 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 DesignMediumAuto-graded
    Flag Rule Resolver with Hash-Bucketed Rollouts

    Simulate a feature-flag service: match attribute rules, gate by a SHA-256 percentage bucket, and resolve conflicts so any matching "on" rule wins.

    Data Structure Designsimulationhashingrules-enginedesign
  • 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 DesignMediumAuto-graded
    Batch Word and In-Order Phrase Lookup Over Text Documents

    Build an inverted index with token positions to answer whole-word and in-order phrase queries over documents, handling repeated words and punctuation.

    Data Structure Designinverted-indexhash-mapbinary-searchtokenization
  • Data Structure DesignMediumAuto-graded
    Rolling-Window Request Throttle Per Client Address

    Simulate a per-IP sliding-window-log throttle over a sequence of requests, using per-key queues with lazy expiry and strict half-open window boundaries.

    Data Structure Designsliding-windowdequehash-maprate-limiter
  • 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 DesignMediumAuto-graded
    Ring Buffer Double-Ended Queue Simulator

    Simulate a bounded double-ended queue over a batch of commands using a circular buffer with constant-time operations and correct index wraparound.

    Data Structure Designdequecircular-buffersimulationdesign
  • Data Structure DesignMediumAuto-graded
    Live Poll Leaderboard: Track the Current Front-Runner

    Process a batch of vote and leader-query operations over named options, using counters and a tie-break rule to report the current leader after each query efficiently.

    Data Structure Designhash-mapheapsimulationtie-breaking
  • 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 DesignHardAuto-graded
    Fault-Tolerant Task Dispatcher with Retry Limit and Dependencies

    Simulate a job queue where failed jobs retry up to a limit, then go to a dead-letter list, and failures cascade to jobs that depend on them.

    Data Structure Designsimulationqueuegraphstate-machine
  • 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 DesignEasyAuto-graded
    Simulate a Task Management Engine with CRUD Operations

    Simulate an in-memory task tracker handling creation, retrieval, updates, filtering, and deletion of tasks with valid state validation.

    Data Structure Designdesign-dsarraysdata-structuressimulation
  • 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 DesignMediumAuto-graded
    Conditional Form Visibility with Numeric Checks and Nested Groups

    Decide which questions of a form are visible by parsing typed answers and evaluating validated, nestable all/any conditions with numeric comparisons.

    Data Structure Designparsingvalidationrecursiondecimal
  • 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 DesignMediumAuto-graded
    Phrase Completion Engine with Windowed Context Counts

    Simulate a command sequence on a context-based next-word model, using hash maps of counts and a lexicographic tie-break.

    Data Structure Designhash-mapn-gramsimulationstring-processing
  • 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