KatInterview

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

Data Structure Design Interview Problems

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

5974
Problems
2212
Auto-graded
15
Topics
269
Added today

Showing 151–180 of 737 results

  • Data Structure DesignHardModel answer
    Greedy Longest-Match Subword Encoder Built on a Byte Trie

    Design and implement a deterministic subword encoder that uses a trie for longest-match lookup, with lossless Unicode handling, versioned vocabularies, tests, and a comparison with BPE and WordPiece.

    Data Structure Designtrietokenizerunicodenlp
  • Data Structure DesignMediumAuto-graded
    Latest-Wins Priority Job Runner Simulation

    Simulate a job runner where resubmitting an ID overrides its earlier entry, testing heap-based lazy deletion with tie-breaking and run-once rules.

    Data Structure Designheaplazy-deletionsimulationhash-map
  • Data Structure DesignMediumModel answer
    Star Feedback Widget with Compose and a ViewModel

    Build a Compose feedback form with a 1-5 star selector, a capped comment field and an async submit, driven by a single ViewModel state stream that survives rotation and double taps.

    Data Structure Designkotlinjetpack-composeandroidmvvm
  • Data Structure DesignMediumModel answer
    Reversible Edit History for a Formula-Driven Grid

    Design a command-based history for a spreadsheet that undoes and redoes cell edits, row deletions and batches, recomputes dependent formulas, handles irreversible actions, and bounds memory.

    Data Structure Designcommand-patternundo-redomementodependency-graph
  • Data Structure DesignMediumAuto-graded
    Most Connected User Tracker with Variable Top-K Queries

    Maintain distinct-contact counts for users from undirected messages, answer the top user in O(1), and return a top-k list with deterministic tie-breaking.

    Data Structure Designhash-sethash-mapheapsimulation
  • Data Structure DesignHardModel answer
    Hardening a Coalescing TTL Cache: Failures, Invalidation, Eviction

    Review a promise-coalescing TTL cache in TypeScript, find its failure, invalidation and memory bugs, write a fixed version, and explain how to port it safely to multithreaded C++20.

    Data Structure Designasynccacherace-conditionslru
  • Data Structure DesignEasyAuto-graded
    In-Memory Store with Transaction Layering

    Implement an in-memory key-value database supporting GET, SET, DELETE, and nested transaction semantics (BEGIN, ROLLBACK, COMMIT).

    Data Structure Designdesign-dsstacks-queuesarraysstrings
  • Data Structure DesignMediumAuto-graded
    Path-Addressed Tree Store: Replay a Command Log

    Simulate a path-keyed tree store by replaying a list of commands, testing trie or hash-map design, path validation, and exact failure semantics.

    Data Structure Designdesigntriehash-mapsimulation
  • Data Structure DesignMediumModel answer
    Build an In-Memory Price History Store with One-Shot Updates

    Design a per-symbol price store supporting lookups, custom change formulas, atomic range updates that can touch each slot only once, and a switch from daily to hourly data.

    Data Structure Designdata-structure-designtime-seriesatomic-updateshash-map
  • Data Structure DesignHardAuto-graded
    Best-Fit Block Allocator with Coalescing and Log-Time Operations

    Simulate a best-fit extent allocator over a huge block range, where reserve and release must merge adjacent free runs and run in logarithmic time.

    Data Structure Designdesignordered-settreapcoalescing
  • Data Structure DesignMediumAuto-graded
    Batch Simulation of Conflict-Free Node Locks on a Rooted Tree

    Process a batch of lock, unlock and query operations on a rooted tree where no locked node may be an ancestor or descendant of another, using subtree ranges and Fenwick trees.

    Data Structure Designtreeeuler-tourfenwick-treedesign
  • Data Structure DesignMediumAuto-graded
    Simulate a Multi-User File Store with Quotas and Compression

    Simulate a command-driven in-memory file store with ownership, per-user quotas, prefix/suffix search, quota-driven eviction and size-changing renames.

    Data Structure Designdesignhash-mapsimulationsorting
  • Data Structure DesignMediumModel answer
    Binary Wire Format for a Nested Key-Value Map

    Design and implement a versioned, checksummed binary format that converts a nested key-value map to bytes and back, and compare it with JSON and MessagePack.

    Data Structure Designserializationbinary-formatchecksumversioning
  • Data Structure DesignHardModel answer
    Design an In-Memory Sentence Search Index

    Design a data structure that supports adding, removing, and efficiently querying sentences by keyword in real time.

    Data Structure DesignData Structure DesignInverted IndexStringHash Table
  • Data Structure DesignMediumAuto-graded
    Replay Requests Through a Per-Key Throttle

    Simulate a per-key sliding-window throttle over a batch of timed requests, tracking only accepted requests and handling window-boundary expiry correctly.

    Data Structure Designsliding-windowdequehash-mapsimulation
  • Data Structure DesignMediumAuto-graded
    Simulate Snapshot Set Operations and Iterators

    Simulate mutation and snapshot iteration on a persistent set structure using interval-based logical timestamps.

    Data Structure Designdesign-dsarraysdata-structures
  • Data Structure DesignMediumModel answer
    Real-Time Log Event Aggregation in React

    Design and build a React component that ingests a real-time event stream, aggregates stats per category, handles out-of-order timestamps, and throttles re-renders for high throughput.

    Data Structure Designreactdata-structuresstreamingperformance
  • Data Structure DesignEasyAuto-graded
    Design a Deduplicated Storage System

    Simulate file system operations while maintaining deduplicated content storage using reference counting.

    Data Structure Designdesign-dsarraysstrings
  • Data Structure DesignEasyModel answer
    Recency-Evicting Store and Random Gift-Swap Pairing

    Two short coding tasks: build a fixed-size store that drops the least recently touched key in constant time, and pair up participants from a CSV so nobody draws themselves.

    Data Structure Designlru-cachehash-mapdoubly-linked-listderangement
  • Data Structure DesignEasyModel answer
    Show How to Use a Move-Only Heap Buffer in C++, and Defend It

    Read a move-only C++ class that owns a heap array, write a clean example program that uses it correctly, and explain the ownership, move, noexcept, explicit and const rules behind it.

    Data Structure Designcppraiimove-semanticsrule-of-five
  • Data Structure DesignMediumAuto-graded
    Run-of-K Grid Game Simulator for Many Players

    Simulate an N x N, M-player connect-K game with turn order, move validation, win detection from the last move, board snapshots and undo.

    Data Structure Designsimulationgriddesignundo
  • Data Structure DesignMediumAuto-graded
    Roster Coverage and Rating Leaderboard Simulator

    Simulate a command log against a stateful tracker that merges per-agent time intervals and ranks agents by average rating with alphabetical tie-breaking.

    Data Structure Designdesignintervalshash-mapsorting
  • Data Structure DesignMediumAuto-graded
    Batch-Driven Slash-Path Registry with Leaf-Only Deletion

    Simulate a tree-shaped registry addressed by slash-separated paths, processing a batch of create, set, get and remove commands and returning one result per command.

    Data Structure Designtriehash-mapdesignstring-parsing
  • Data Structure DesignHardModel answer
    Design an In-Memory Recipe Storage Engine

    Design and implement an in-memory storage manager supporting CRUD operations, custom identifier parsing, case-insensitive uniqueness, and controlled renames.

    Data Structure Designdesign-dsarraysstrings
  • Data Structure DesignMediumAuto-graded
    Append-Only Editor with Undo and Redo Replay

    Simulate a tail-only text buffer with undo and redo histories, recording only edits that change the text and clearing redo on every new edit.

    Data Structure Designdesignstacksimulationundo-redo
  • Data Structure DesignHardModel answer
    Reframing Chunked Async Reads into Length-Prefixed Frames

    Turn an async sequence of arbitrarily split byte chunks into complete frames, each preceded by a 4-byte big-endian length, while handling truncation and oversized lengths.

    Data Structure Designstreamingstate-machineasyncbinary-parsing
  • Data Structure DesignMediumModel answer
    Concurrent Micro-Batching Writer with Backpressure and Timed Flush

    Build a thread-safe buffer that accepts records from many producers and writes them to a database in batches, triggered by size, age of the oldest record, or shutdown, without holding locks during I/O.

    Data Structure Designconcurrencycondition-variablesbackpressurebatching
  • Data Structure DesignMediumModel answer
    Build a Shutdown-Aware Producer/Consumer Queue in C++

    Design a generic, thread-safe C++ queue where consumers block when it is empty and a shutdown call releases every waiting thread once the remaining items are drained.

    Data Structure Designcppconcurrencymutexcondition-variable
  • Data Structure DesignMediumModel answer
    Expiring Store, Reversible Actions, and Org Chart Walk

    Three short design-and-code tasks: a key-value store with per-entry lifetimes and background pruning, an action history with undo/redo, and a depth-first walk over a hierarchy.

    Data Structure Designcachettlmin-heapundo-redo
  • Data Structure DesignMediumModel answer
    Photo Slideshow with Ranked Comment Threads and Safe Voting

    Design a slideshow widget plus per-photo comment threads with idempotent voting and fast top-k ranking, scaling to 10^5 photos and 10^6 comments.

    Data Structure Designdata-structure-designsorted-indexidempotencypagination