KatInterview

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

Data Structure Design Interview Problems

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

5965
Problems
2208
Auto-graded
15
Topics
271
Added today

Showing 1–30 of 737 results

  • Data Structure DesignMediumModel answer
    Deadlock-Free Atomic Funds Movement Between Shared Accounts

    Design a concurrent transfer operation over an in-memory account store that never loses updates, is all-or-nothing, preserves total money, and cannot deadlock.

    Data Structure Designconcurrencylockingdeadlockatomicity
  • Data Structure DesignMediumModel answer
    Python ABCs and the Three Kinds of Methods Explained

    Explain how abstract base classes work in Python and how instance, class and static methods differ in binding, inheritance behavior and typical use.

    Data Structure Designpythonoopabstract-classesclassmethod
  • Data Structure DesignMediumModel answer
    Handling Seekable Body Replays on 307 Redirects in Python requests

    Debug and implement stateful body rewind logic for seekable file-like streams when executing HTTP 307 redirects in an HTTP client library.

    Data Structure Designpythonhttpdebuggingstreams
  • Data Structure DesignMediumAuto-graded
    Locate a Traveler's Airport by Timestamp

    Process a batch of operations that load travel records and answer per-user point-in-time location queries using grouping, sorting and binary search.

    Data Structure Designbinary-searchhash-mapintervalsdesign
  • Data Structure DesignMediumAuto-graded
    Room Assignment and Leaderboard for Streaming Sessions

    Simulate a stream of operations that assigns sessions to the lowest-numbered free room and reports the top-k streams by total duration, tested with heaps and lazy deletion.

    Data Structure Designheapdesignsimulationlazy-deletion
  • Data Structure DesignMediumModel answer
    Design a Blackjack Game Engine

    Architect an object-oriented Blackjack engine handling multi-deck shoes, split hands, and soft/hard total calculations.

    Data Structure DesignData Structure DesignObject-Oriented DesignState Machine
  • Data Structure DesignEasyAuto-graded
    Sliding Five-Minute Hit Tally for Each Caller

    Process a batch of hit and query operations, returning each caller's number of hits within an inclusive 300-second window, using per-caller queues with lazy expiry.

    Data Structure Designhash-mapqueuesliding-windowsimulation
  • Data Structure DesignHardAuto-graded
    Best-Fit Block Manager with Splitting and Merging

    Simulate a best-fit memory manager on a fixed address range, handling splits, exact-start frees, invalid frees, and merging of neighboring free blocks using plain lists.

    Data Structure Designsimulationbinary-searchmemory-allocatorbest-fit
  • Data Structure DesignMediumModel answer
    Build a Batch Grayscale Thumbnailer with Worker Pools

    Design and code a Pillow-based batch tool that grayscales and shrinks images, then scale it to many large files with multiprocessing, robust error handling, bounded memory and benchmarks.

    Data Structure Designpythonpillowmultiprocessingconcurrency
  • Data Structure DesignMediumAuto-graded
    Smallest Free Label per Category: Batch Simulation

    Simulate a sequence of allocate and release operations on independent categories, always handing out the smallest free positive integer, using a counter plus a min-heap per category.

    Data Structure Designheaphash-mapsimulationdesign
  • Data Structure DesignMediumAuto-graded
    Design an In-Memory Key-Value Engine with Transactions

    Implement an in-memory key-value database supporting frequency counting and nested transaction rollbacks.

    Data Structure Designhash-tablestackdesigndata-structures
  • Data Structure DesignEasyAuto-graded
    Simulate a Time-To-Live (TTL) Key-Value Store

    Process a series of operations on an in-memory key-value store with fixed time-to-live expiration dynamics.

    Data Structure Designdesign-dshash-table
  • Data Structure DesignHardModel answer
    Build a Thread-Safe Dual-Resource Allocator

    Design a concurrency controller that manages exclusive access to two distinct targets while preventing deadlocks and invalid release calls.

    Data Structure Designconcurrencymultithreadinglockssynchronization
  • Data Structure DesignMediumModel answer
    Debugging a LinkedHashMap-Based Eviction Cache in Java

    Review a Java cache built on LinkedHashMap that evicts the wrong entries, find each defect, write minimal failing tests, and produce a corrected version.

    Data Structure Designlru-cachejavalinkedhashmapdebugging
  • Data Structure DesignEasyAuto-graded
    Simulate Driver Availability and Task Allocation

    Simulate driver registration and dispatch operations using standard queue processing and state tracking.

    Data Structure Designdata-structuresqueueshash-tablesimulation
  • Data Structure DesignMediumAuto-graded
    Compute Compressed Vector Inner Product

    Process dynamic creation of compressed vectors and compute inner products using sparse representations.

    Data Structure Designarraysdesign-dshash-table
  • Data Structure DesignMediumAuto-graded
    Design a Recency-Tracking Key-Value Store

    Simulate operations on a custom key-value map that efficiently queries the most recently updated active entry.

    Data Structure Designdesign-dslinked-listsarrays
  • Data Structure DesignMediumModel answer
    Audited Lazy File Streaming with Generators, Decorators and with

    Build a decorator that audits a chunked file-reading generator's lifecycle, with deterministic file cleanup on completion, early exit, errors and garbage collection.

    Data Structure Designpythongeneratorsdecoratorscontext-managers
  • Data Structure DesignMediumModel answer
    Making a Memoizing Python Function Safe for Many Threads

    Critique a Python function that caches expensive results in a dict, then make it thread-safe so each input is computed once, without blocking cache hits or unrelated inputs.

    Data Structure Designpythonconcurrencycachinglocking
  • Data Structure DesignMediumAuto-graded
    Stream Merging Iterator for Two Ordered Sequences

    Simulate a stateful iterator that lazily combines two strictly sorted sequences into a single sorted, duplicate-free stream using constant space.

    Data Structure Designdesign-dsarraysheaps-sorting
  • Data Structure DesignMediumAuto-graded
    Wildcard Word Dictionary Simulator

    Simulate a word store that answers pattern queries where '.' stands for any single letter, which is best handled with a prefix tree and a depth-aware traversal.

    Data Structure Designtriedesignwildcarddfs
  • Data Structure DesignMediumAuto-graded
    Sliding Window Stream Aggregator

    Design a memory-efficient real-time streaming data structure to query moving averages over a sliding temporal window.

    Data Structure Designsliding-windowdequedesignstream-processing
  • Data Structure DesignMediumModel answer
    Versioned Follow Graph with Time-Travel Queries and Suggestions

    Build an in-memory directed follow graph with cheap snapshots, historical edge lookups, and a friends-of-friends suggestion ranking with id tie-breaks.

    Data Structure Designgraphsnapshotsbinary-searchheap
  • Data Structure DesignMediumModel answer
    Live Scoreboard Engine for One Tennis Game

    Process a sequence of point winners for a single tennis game and print the correct score after each point, including deuce, advantage and the win-by-two rule.

    Data Structure Designsimulationstate-designclass-designedge-cases
  • Data Structure DesignMediumAuto-graded
    In-Memory Bank Ledger with Pending Transfers and Expiry

    Simulate an in-memory banking system processing sequential operations, pending transfers with fixed-window expiration, and account activity tracking.

    Data Structure DesignData StructuresSimulationDesignHash Table
  • Data Structure DesignEasyAuto-graded
    Duel Resolver: Speed, Types and Chip Damage

    Simulate a two-creature duel with fixed speed order, a minimum-damage floor, and a type-advantage multiplier, then return the winner's name.

    Data Structure Designsimulationdictionariesfloating-pointgame-logic
  • Data Structure DesignMediumModel answer
    Snapshot and Restore for an In-Memory String Map

    Build an in-memory string map in C++ that can dump its full state to a byte buffer and rebuild it, handling arbitrary bytes, corrupt input, and failed restores safely.

    Data Structure Designserializationbinary-formathash-mapinput-validation
  • Data Structure DesignMediumAuto-graded
    Simulate a Stateful Banking Ledger with Queued Payments

    Simulate an in-memory banking system handling accounts, balances, scheduled payments via a priority queue, and account merges.

    Data Structure Designheaphash-tablesimulationdesign-ds
  • Data Structure DesignMediumModel answer
    Thread-Safe Ledger for Courier Payouts and Client Invoices

    Design an in-memory, thread-safe ledger that upserts delivery records and serves instant per-courier earnings and per-client invoice totals in integer cents.

    Data Structure Designconcurrencyhash-mapincremental-aggregationlow-level-design
  • Data Structure DesignMediumModel answer
    Design a Custom CSV Parsing and Filtering Engine

    Implement an in-memory CSV query processor with auto-type inference and polymorphic field filtering.

    Data Structure Designparsingdesign-dsstringsarrays