KatInterview

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

Data Structure Design Interview Problems

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

5979
Problems
2215
Auto-graded
15
Topics
273
Added today

Showing 211–240 of 376 results

  • Data Structure DesignMediumAuto-graded
    Closest Repeat Distance with Fast Threshold Queries

    Precompute the smallest distance between equal values in an array once, then answer many "repeat within k" and "closest repeat" queries in constant time each.

    Data Structure Designhash-mappreprocessingbatch-queriesarrays
  • Data Structure DesignMediumAuto-graded
    Simulate a Four-Seat Trick-Taking Card Game with Scoring

    Simulate a full 13-trick, four-player card game with deterministic dealing, follow-suit rules, and point scoring, and return the complete game record.

    Data Structure Designsimulationstate-managementsortinghash-map
  • Data Structure DesignMediumAuto-graded
    Count-Feature Text Classifier via Command Replay

    Simulate a stateful multinomial Naive Bayes model driven by fit and predict commands, using smoothed log-probabilities and a deterministic tie-break.

    Data Structure Designnaive-bayessimulationlog-probabilitiessmoothing
  • Data Structure DesignMediumAuto-graded
    Versioned Lookup Store with Inclusive Range Event Tally

    Simulate a batch of commands on a per-key timestamped value history and an event log, using binary search for point-in-time lookups and inclusive range counts.

    Data Structure Designbinary-searchhash-mapdesignsimulation
  • Data Structure DesignMediumAuto-graded
    Recency-Evicting Cache Simulator

    Simulate a fixed-capacity key-value store that evicts the least recently used entry, processing a batch of get and put commands in constant time each.

    Data Structure Designhash-mapdoubly-linked-listlru-cachesimulation
  • Data Structure DesignMediumAuto-graded
    Lifespan Lookups for Orders and Order Groups in a Replay Log

    Simulate a class through an operations list, tracking per-order and per-group start and end times so lookups run in constant time, with groups reporting 0 while any member is open.

    Data Structure Designhash-mapdesignsimulationaggregation
  • Data Structure DesignMediumAuto-graded
    Duplicate Log Suppression Within a Cooldown Window

    Simulate a duplicate-log filter driven by an operation script, tracking per-message cooldowns where only accepted messages restart the timer.

    Data Structure Designhash-mapdesignsimulationrate-limiting
  • Data Structure DesignMediumAuto-graded
    Slide a Block in a Grid and Filter Repeated Log Calls

    Move a rectangular block inside a 2D grid without corrupting overlapping data, then run a sliding-window duplicate filter over a list of timestamps.

    Data Structure Designmatrixin-placesliding-windowdeque
  • Data Structure DesignMediumAuto-graded
    Per-Tab Navigation Timeline Replay

    Simulate independent per-tab navigation timelines with a cursor, supporting visit, back and forward, and replay a batch of operations to collect their results.

    Data Structure Designdesignhash-mapsimulationcursor
  • Data Structure DesignHardAuto-graded
    Track Covered Spans Under Add, Erase and Check Commands

    Maintain a set of half-open real intervals under add, remove and fully-covered queries, merging touching spans and splitting spans on removal.

    Data Structure Designintervalsbinary-searchsimulationsorted-list
  • Data Structure DesignMediumAuto-graded
    Rolling Forklift Ping Counts with Late Arrivals and Shift Tracking

    Simulate a fleet telemetry service that tracks per-forklift pings in a global 15-minute window, handles late pings, and counts clocked-in forklifts.

    Data Structure Designsliding windowheaphash mapdata structure design
  • Data Structure DesignEasyAuto-graded
    Bidirectional Page Navigation with Integer Cursors

    Simulate a paginator that serves pages forward and backward from integer cursors, with correct clamping at both ends and for a short final page.

    Data Structure Designdesignpaginationsimulationarray-slicing
  • Data Structure DesignMediumAuto-graded
    Quota-Based Storage Service Simulator with Snapshots

    Simulate a command stream on a storage service with per-user quotas, ownership transfer, prefix-based top-n listing, and per-user snapshot and restore.

    Data Structure Designdesignhash-mapsimulationsorting
  • Data Structure DesignMediumAuto-graded
    Snapshot-based key-value store with checkpoint and reload

    Simulate a key-value store that serializes its full contents on checkpoint and replaces live state on reload, testing state management and round-trip serialization.

    Data Structure Designdesignserializationkey-value storestate management
  • Data Structure DesignMediumAuto-graded
    LRU Cache Simulator with Recency and Grouped Views

    Simulates an LRU cache through a sequence of put, get, and snapshot operations, testing recency bookkeeping, eviction, and ordered grouping of values.

    Data Structure DesignLRU cacheOrderedDicthash mapsimulation
  • Data Structure DesignMediumAuto-graded
    Batch Simulation of an Expiring LRU Key-Value Store

    Replay a batch of timestamped get and set operations against a fixed-capacity store that combines per-key expiry with least-recently-used eviction.

    Data Structure Designhash maplinked listLRU cachesimulation
  • Data Structure DesignMediumAuto-graded
    Train Line Fare System with Dynamic Routes and Weekend Pricing

    Tests object-oriented design, index lookups, dynamic data structure updates, and conditional pricing rules in a fare calculation system.

    Data Structure Designobject-oriented-designhash-mapsimulation
  • Data Structure DesignMediumAuto-graded
    Tiered Cache with TTL and Priority Fallback

    Implement a hierarchical key-value cache with expiration times, priority-based lookups, and lazy eviction across multiple storage tiers.

    Data Structure Designhash-tableheapdata-structure-design
  • Data Structure DesignHardAuto-graded
    Policy-Driven Spending Report Checker

    Tests whether a candidate can implement a multi-scope rule evaluation pipeline that collects all violations across item-level, aggregate, and relational policy checks.

    Data Structure Designobject-oriented designopen-closed principledata aggregation
  • Data Structure DesignMediumAuto-graded
    Maintain Dynamic Multiset with Rank Queries

    Tests the ability to build a structure that handles insertions and k-th largest queries efficiently using a Fenwick tree over the value domain.

    Data Structure Designfenwick-treebinary-indexed-treerank-queriesmultiset
  • Data Structure DesignMediumAuto-graded
    Simulate a Least Recently Used Cache with Fixed Capacity

    Tests understanding of LRU eviction policy through hash map and doubly-linked list composition to achieve O(1) operations.

    Data Structure Designhash-maplinked-listcachelru
  • Data Structure DesignHardAuto-graded
    Type-Safe Storage with Lifetime Tracking

    Tests understanding of object lifetime management, type tracking, and exception safety in a discriminated union implementation.

    Data Structure Designobject-lifetimetype-safetyexception-handling
  • Data Structure DesignHardAuto-graded
    Versioned Membership Tracker with Point-in-Time Queries

    Tests ability to design a copy-on-write set that records per-element change history and answers historical membership queries in O(log n) via binary search.

    Data Structure Designbinary searchdesignhash map
  • Data Structure DesignMediumAuto-graded
    Sliding Window Request Rate Calculator

    Tests the ability to implement time-bucketed sliding-window aggregation with efficient memory usage and amortized constant-time operations.

    Data Structure Designsliding-windowtime-seriesdata-structuresamortized-analysis
  • Data Structure DesignMediumAuto-graded
    Sliding Window Event Log with Time-Based Expiration

    Design a data structure that tracks timestamped events and supports queries over a moving time window with automatic expiration of old entries.

    Data Structure Designsliding-windowqueuestime-seriesdata-structures
  • Data Structure DesignMediumAuto-graded
    Aggregate Sales Data with Running and Grand Totals

    Tests dictionary aggregation, deterministic ordering, and building cumulative totals along two dimensions from grouped records.

    Data Structure Designaggregationdictionariesdata-processing
  • Data Structure DesignMediumAuto-graded
    Simulated Word Store with Prefix Query

    Tests trie-style prefix counting logic via operation replay, with optional case-insensitive and trailing-digit normalization flags.

    Data Structure Designtriestringssimulation
  • Data Structure DesignHardAuto-graded
    Running Median Over a Live Integer Feed

    Tests whether a candidate can design a two-heap structure that inserts integers and queries the running median in better than O(N) time per operation.

    Data Structure Designheapsdesignstreaming
  • Data Structure DesignMediumAuto-graded
    Mini Query Engine: Filter, Sort, and Project Rows

    Tests ability to implement a pipeline of filter, multi-column sort, and column projection over a list of in-memory row dicts.

    Data Structure Designdata structuressortingfiltering
  • Data Structure DesignMediumAuto-graded
    Bounded Cache with Least-Recently-Used Eviction

    Simulate a capacity-limited key–value cache where lookups and writes both refresh recency and the oldest entry is evicted on overflow.

    Data Structure Designhash-maplinked-listcachesimulation