KatInterview

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

Data Structure Design Interview Problems

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

5973
Problems
2212
Auto-graded
15
Topics
271
Added today

Showing 241–270 of 362 results

  • Data Structure DesignMediumModel answer
    Build a Weighted Consistent Hash Ring

    Design and code a hash ring that maps keys to servers with virtual nodes, supporting weighted capacity and minimal key movement on topology changes.

    Data Structure Designhashingdistributed-systemsdata-structuresbinary-search
  • Data Structure DesignMediumModel answer
    Dependency-Aware Job Scheduler with Priority Queues

    Build an in-memory scheduler that tracks job prerequisites, selects the next runnable job by a four-field priority rule, supports filtered queries, and detects deadlocks.

    Data Structure Designheaptopological-sortgraphsimulation
  • Data Structure DesignMediumModel answer
    Continuous-Batch Inference Loop with Slot Refilling

    Implement a dynamic batching generation loop that keeps a fixed-size batch full by refilling completed slots from a waiting queue until all requests are served.

    Data Structure Designbatchinginferencesimulationqueue
  • Data Structure DesignMediumModel answer
    Model a Prepaid Spending Account with Transaction Limits

    Design a class hierarchy that tracks a spending cap, running balance, and transaction history while safely handling concurrent charges and edge-case inputs.

    Data Structure Designobject-oriented designconcurrencystate managementPython
  • Data Structure DesignMediumModel answer
    Fix a Broken Round-Robin Load Balancer

    Debug and repair a round-robin router that mis-assigns requests when servers are added, removed, or marked unhealthy, then write tests covering the edge cases.

    Data Structure Designround-robinload-balancingdebuggingconcurrency
  • Data Structure DesignMediumModel answer
    Library Loan Alert Engine: Holds, Checkouts, and Due Reminders

    Design a notification manager for a book lending system that handles hold queues, checkout allocation, and idempotent due-date alerts.

    Data Structure Designheapsimulationidempotencyqueue
  • Data Structure DesignMediumModel answer
    Extensible Card Hand Evaluator with Pluggable Rules

    Design and incrementally build a card-hand evaluator that ranks hands, resolves ties deterministically, adds new categories, and applies a swappable discard rule.

    Data Structure Designobject-oriented designextensibilitygame logic
  • Data Structure DesignMediumModel answer
    File Storage Manager with Quota Enforcement

    Build an in-memory file manager that tracks user storage, enforces capacity limits, and evicts largest files when quotas shrink.

    Data Structure Designhash-mapheaplazy-deletionquota-management
  • Data Structure DesignMediumModel answer
    Sliding-Window Trending URLs with Deduplication

    Design a data structure that tracks the most-visited URLs over a configurable recent time window, with idempotent inserts and efficient eviction.

    Data Structure Designsliding-windowheaphash-mapstreaming
  • Data Structure DesignMediumModel answer
    Random Draw from a Mutable Membership Set in O(1)

    Build a container that registers and removes integer keys and returns a uniformly random current key, all in average constant time.

    Data Structure Designhash-maparrayrandomizedconstant-time
  • Data Structure DesignMediumModel answer
    File Storage with Quotas, Copy, and Compression

    Build an in-memory file system tracking per-user storage limits, supporting file operations including duplication, compression, and quota-driven eviction.

    Data Structure Designhash-mapheapobject-oriented-designbookkeeping
  • Data Structure DesignMediumModel answer
    Build a Bounded In-Memory File System with Auto-Rename

    Design a trie-backed file system supporting path-based file insertion and directory listing, with a per-directory capacity cap and OS-style duplicate renaming.

    Data Structure Designtriehash-mapfile-systemOOP
  • Data Structure DesignMediumModel answer
    Build an Expiry-Aware LRU Cache Without Scanning Every Key

    Design an in-memory cache that enforces capacity with LRU eviction and per-entry TTL, keeping expiration efficient without iterating all keys.

    Data Structure Designcachelruttlconcurrency
  • Data Structure DesignMediumModel answer
    Order Book Simulator with Fair Volume Participation

    Build a limit order matching engine, then add participation-rate execution logic for one client, and finally extend to multiple clients with fair allocation.

    Data Structure Designorder-bookpriority-queuesimulationgreedy
  • Data Structure DesignMediumModel answer
    Path Template Router with Variables and Wildcard Tails

    Build a trie-based URL router that registers templates with named captures and wildcard tails, resolves concrete paths with literal-first precedence and backtracking, and detects shape conflicts.

    Data Structure Designtrieroutingbacktrackingdesign
  • Data Structure DesignMediumModel answer
    Company Hierarchy Query System with Dynamic Updates

    Build a data structure to efficiently query employee roles and reporting counts in a company hierarchy, then extend it to handle dynamic additions.

    Data Structure Designtreesgraphspreprocessingaggregation
  • Data Structure DesignHardModel answer
    Greedy Text Tokenizer with Vocabulary Trie

    Build a tokenizer that greedily matches the longest vocabulary token at each position, handling unknown characters with optional span merging.

    Data Structure Designtriestring-matchingtokenizationgreedy-algorithms
  • Data Structure DesignMediumModel answer
    Duplicate-Aware Collection with O(1) Random Sampling

    Design a multiset supporting insert, remove, and uniform random sampling over all occurrences, each in expected O(1) time.

    Data Structure Designhash-maparrayrandomnessdata-structure-design
  • Data Structure DesignEasyModel answer
    Two-Part Challenge: Token Frequencies and Multiset Overlap with a Barebones RDD

    Using only flatMap, groupByKey, union, and collect on a minimal RDD class, implement word counting and a duplicate-preserving intersection of two datasets.

    Data Structure Designrddword-countmultiset-intersection
  • Data Structure DesignMediumModel answer
    Build an Edit History System with Batching

    Implement a command history mechanism supporting single edits, grouped operations, and bidirectional traversal through past states.

    Data Structure Designundo-redocommand-patternstate-management
  • Data Structure DesignMediumModel answer
    Build a Scoped Owner and a Resizable Container from Scratch

    Implement a move-only smart pointer and a generic dynamic array in C++, exercising RAII, the Rule of Five, placement new, and exception-safe resizing.

    Data Structure Designc++memory-managementraiimove-semantics
  • Data Structure DesignHardModel answer
    Building a Live Text Editor: Buffer, History, and Suggestions

    Design and implement a text editor with insert/delete operations, undo/redo history, prefix-based autocomplete with frequency ranking, and multi-user concurrent editing.

    Data Structure Designdata-structuresundo-redotrieoperational-transformation
  • Data Structure DesignMediumModel answer
    Extend a Python Abstract Pipeline with a Concrete File Processor

    Implement a concrete subclass inside a pre-built abstract framework that streams CSV input, transforms rows to JSON, and self-registers with a CLI factory.

    Data Structure Designobject-oriented-designabstract-base-classfile-iostreaming
  • Data Structure DesignHardModel answer
    Ride-Share Wallet: Credit Vouchers, Zone Surcharges, and Refunds

    Simulate a ride-share payment ledger that drains expiring vouchers in priority order, applies zone-based surcharges to card charges, and splits refunds between card and new store credit.

    Data Structure Designsimulationpriority-queueinteger-mathstate-machine
  • Data Structure DesignMediumModel answer
    Event-Driven Email Notification System with Account Updates

    Build a scheduler that emits subscription notifications in time order, handling plan switches and subscription extensions with deterministic tie-breaking.

    Data Structure Designheapssimulationevent-drivenscheduling
  • Data Structure DesignMediumModel answer
    Design a Lazy Iterator Pipeline with Range and Combinators

    Build a pull-based iterator for ranges with configurable steps and endpoints, plus composable transformations like map, filter, zip, take, drop, and chain.

    Data Structure Designiteratorslazy-evaluationfunctional-programming
  • Data Structure DesignHardModel answer
    Build a Concurrent Multi-Constraint Rate Limiter

    Design a thread-safe class that enforces several independent rate limits simultaneously, with atomic all-or-nothing permit acquisition and rollback on failure.

    Data Structure Designconcurrencyrate-limitingsliding-windowatomicity
  • Data Structure DesignMediumModel answer
    Async URL Batch Fetcher with Concurrency Limits

    Build an async function that fetches a list of URLs with bounded parallelism, deduplicates identical URLs, preserves input order, and isolates per-URL errors.

    Data Structure Designasyncconcurrencypythondeduplication
  • Data Structure DesignMediumModel answer
    Alphabet-Coverage Web Crawler with Rate Limiting

    Build a crawler that prioritizes unvisited first-letters across a link graph while respecting a configurable requests-per-second ceiling.

    Data Structure Designcrawlingrate-limitingpriority-queuededuplication
  • Data Structure DesignMediumModel answer
    Four Algorithm Problems: Graphs, Search, Simulation, and Design

    Solve four independent problems covering Eulerian path reconstruction, timestamped key-value lookup, ray reflection simulation, and a high-throughput score tracker.

    Data Structure Designgraphsbinary-searchsimulationdata-structure-design