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
272
Added today

Showing 61–90 of 362 results

  • Data Structure DesignHardModel answer
    Dynamic Room Occupancy Tracker with Top-K Ranking Query

    Design an in-memory system tracking occupancy and entry times across rooms, returning the busiest rooms in optimal logarithmic time per update.

    Data Structure Designdesign-dsheaps-sortinghash-map
  • Data Structure DesignMediumModel answer
    Designing a Validated In-Memory Cache for Repeated Parsing

    Speed up a script that repeatedly parses files by adding a thread-safe, bounded, in-memory cache, and justify its keys, eviction, staleness checks and complexity.

    Data Structure Designcachinghash-maplruconcurrency
  • Data Structure DesignMediumModel answer
    Design a Safe, Idempotent Auto-Approval Engine for Order Refunds

    Design and code a refund decision engine that applies pluggable rules, never refunds more than was paid, and handles retried or concurrent requests without paying twice.

    Data Structure Designdomain-modelingidempotencyrules-enginemoney-handling
  • Data Structure DesignHardModel answer
    Design a Tree-Based Storage Simulator with Auto-Renaming

    Build an in-memory file store that auto-creates parent folders, renames clashing files with the lowest free numeric tag, and lists folder contents in ASCII order.

    Data Structure Designdesigntreehash-setstrings
  • Data Structure DesignMediumModel answer
    Pluggable Payment Dispatch with Spring Bean Maps

    Design an extensible payment dispatcher in Spring where a Map of strategy beans is injected automatically and new payment methods need no changes to the service.

    Data Structure Designjavaspringstrategy-patternsolid
  • Data Structure DesignMediumModel answer
    BST In-Order Traversal Flow & Priority Queue Dispatcher

    Implement an in-order tree iterator with memory constrained by height, followed by a priority queue that handles multi-attribute ordering rules.

    Data Structure Designtreesstackheappriority-queue
  • Data Structure DesignMediumModel answer
    Modeling a Multi-Car Lift Dispatcher with Swappable Policies

    Design an object-oriented lift (elevator) control system: classes, per-car state machine, stop ordering, pluggable dispatch, edge cases, and testable core logic.

    Data Structure Designobject-oriented-designstate-machinestrategy-patternsimulation
  • Data Structure DesignMediumModel answer
    Building a Cache-Friendly Lookup Table for a Hot Loop

    Design a hash table for a performance-critical inner loop, covering collision strategy, memory layout, probing, load factor, prefetching, and how to benchmark it.

    Data Structure Designhash-tableopen-addressingsimdcache-optimization
  • 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 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 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 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 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 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 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 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 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
  • Data Structure DesignEasyModel answer
    Python Tuples, Dict Internals, and Error Handling in a Record Store

    Answer three fundamentals questions: tuple rebinding and shallow immutability, how a hash table handles insert, lookup, update and delete, and where to raise and catch errors in a record class.

    Data Structure Designpythonimmutabilitytupleshash-table
  • Data Structure DesignMediumModel answer
    Coalescing Single-Key Reads into Timed Batch Requests

    Build a callback-driven client that gathers individual key requests into one batched GET every 100 ms, using only a timer and an async HTTP primitive, while keeping overlapping batches isolated.

    Data Structure Designevent-loopbatchingcallbackstimers
  • Data Structure DesignMediumModel answer
    Object Model and Move Engine for a Sliding-Tile Merge Game

    Design the classes and core move algorithm for a configurable N x N sliding-tile merge puzzle, with testable randomness, win and loss detection, and room for undo.

    Data Structure Designobject-oriented-designgame-logicsimulationdependency-injection
  • Data Structure DesignMediumModel answer
    Build an Expiring LRU Cache with an Injectable Clock

    Design a fixed-capacity cache with least-recently-used eviction and per-entry expiry, and justify your data structures, tests and complexity.

    Data Structure Designlru-cacheordereddictttlunit-testing
  • Data Structure DesignMediumModel answer
    How Hash Tables Handle Collisions, Deletes, and Growth

    Walk through hash table internals: index mapping, chaining versus linear probing, safe deletion, load-factor resizing, and when operations degrade from O(1) to O(n).

    Data Structure Designhash-tablecollision-resolutionlinear-probingload-factor
  • Data Structure DesignHardModel answer
    Boolean Condition Trees for a Spending Policy Checker

    Design a data-driven policy engine whose rules combine field checks with nested AND, OR and NOT, covering representation, validation, missing-field behavior and explainable results.

    Data Structure Designexpression-treerules-enginevalidationboolean-logic