KatInterview

Topic

Data Structure Design interview problems

Caches, iterators, rate limiters and custom containers. 738 original problems, each with hidden test cases you can run in the browser.

Problems738

53 easy588 medium97 hard

Showing 241–270 of 738 results

  • Design and code a fixed-capacity, multi-producer multi-consumer buffer with timed blocking put/get, fair waiter ordering, clean shutdown and backpressure, and explain how you would test it.

    Model answerconcurrencysynchronizationcondition-variablesbackpressure
  • Coordinate grid-based worker nodes to perform memory-efficient distributed matrix multiplication without deadlocks.

    Model answerdistributed systemsmatrix multiplicationconcurrencyalgorithms
  • Design and code a bank ledger that grows in stages: cash operations, per-account statements with failures, internal and external transfers with fees, and delayed transfers that lock funds.

    Model answerledgermoney-handlingobject-oriented-designtransactions
  • Simulate an in-memory single-table key-value store supporting lookup, update, and sorted conditional selection queries.

    Auto-gradedhash-mapdesignsortingstrings
  • Simulate a tracker that links IDs across two systems, stores observations, and returns time-ordered merged histories, testing union-find style grouping and operation replay.

    Auto-gradedunion-finddesignhash-mapsorting
  • Generate discrete random samples according to custom category weights in constant time per sample using Vose's alias algorithm.

    Auto-gradedarraysdesign-dsmath-bits
  • Simulate a versioned basket engine that aggregates multi-recipe component quantities for bulk discount calculations, supporting mutations and rollback operations.

    Auto-gradeddesign-dsarrayshashing
  • Design an in-memory ledger that handles idempotent transfers, top-k senders, rewards posted 24 hours after a purchase, and account merging, and explain how you would test and scale it.

    Model answerdesignhash-mapheapidempotency
  • Simulate a sharded order book that routes users with FNV-1a, enforces a one-way status lifecycle, and answers per-user open-order queries in placement order.

    Auto-gradedhash-mapsimulationstate-machinehashing
  • Design an object-oriented component that ingests ad events and returns windowed per-campaign metric sums and ratios, while letting new event types be added without editing core code.

    Model answerobject-oriented-designtime-seriesprefix-sumsbinary-search
  • Simulate a key-value store that logs reads and writes with timestamps and answers per-second average rate queries over trailing windows, using compact time buckets.

    Auto-gradeddesignsliding-windowdequehash-map
  • Simulate a command-driven chat engine that dispatches messages to registered responders, keeps per-channel logs and per-responder state, and returns the resulting logs.

    Auto-gradeddesignsimulationoophash-map
  • Simulate a priority queue of alerts that serves the highest risk first and the oldest first on ties, driven by a list of Put and GetNext commands.

    Auto-gradedpriority-queueheapdesignsimulation
  • Process sequential financial operations with scheduled transfers, account merging, historical snapshot queries, and activity rankings using heaps and binary search.

    Auto-gradeddesign-dsheaps-sortingarrays
  • Construct an XOR string transformation function alongside an expected constant-time randomized container structure.

    Model answerArraysHash MapBit ManipulationDesign
  • Simulate a mutable integer set whose iterators capture the set's contents at creation time and stay isolated from later changes and from each other.

    Auto-gradeddesignhash-setiteratorsnapshot
  • Design a single-class interactive key-value shell that saves to disk, handles bad input, logs errors, accepts new commands easily, and ships with unit tests, a README, and CI.

    Model answeroopcliunit-testingpersistence
  • Simulate an in-memory banking ledger that processes chronologically ordered operations involving balances, leaderboards, delayed cashbacks, and account merges.

    Auto-gradeddesign-dsheaps-sortingarrays
  • Design an in-memory compute credit ledger handling expiring grants, usage subtractions with earliest-expiration priority, out-of-order event ingestion, and point-in-time balance queries.

    Model answerdesign-dsheaps-sortinggreedy-intervalsarrays
  • Build a reconciler that keeps a cached insurance status correct when verification results arrive late, duplicated, or as failures, and that can rebuild the status from full history.

    Model answeridempotencyout-of-order eventscache consistencystate reconciliation
  • Simulate a fixed-capacity LRU cache keyed by a call's positional and keyword arguments, with order-insensitive, type-aware key matching.

    Auto-gradedlru-cachehash-mapdoubly-linked-listcanonical-keys
  • Simulate concurrent inventory purchases and sales ensuring atomic state updates, preventing negative inventory, and handling invalid operations cleanly.

    Auto-gradeddesign-dsarraysconcurrency
  • Design an event-driven system to track test statuses, calculate minimum recovery durations, and identify the longest continuous window of high concurrent failures.

    Model answerdesign-dsgreedy-intervalsarrays
  • Simulate an event-driven task queue handling execution states, lease timeouts, retry budgets, dependencies, and dead-letter cascading.

    Auto-gradeddesign-dsheaps-sortingtrees-graphsstacks-queues
  • Implement a resilient round-robin request balancer that handles dynamic server membership, followed by a consistent hashing router to maintain key affinity.

    Model answerdesign-dshashingconcurrencybinary-search
  • Simulate a stateful screening service driven by an operation log: whole-token, case-insensitive banned-word checks, replaceable word lists, and per-user flagged-review tallies.

    Auto-gradedhash-sethash-mapsimulationstrings
  • Identify anti-patterns in legacy dispatch assignment code, implement fixes, introduce domain types, and design for thread-safety.

    Model answerrefactoringthread-safetyobject-oriented-designclean-code
  • Simulate a fixed-capacity Least Recently Used (LRU) storage engine that processes lookup and insert operations in O(1) time.

    Auto-gradeddesign-dslinked-listsarrays
  • Implement thread-safe Round-Robin and Consistent Hashing balancers supporting health checks and dynamic nodes, then analyze their performance.

    Model answerload-balancerconsistent-hashinground-robindata-structure-design
  • Design a thread-safe in-memory audio player with a queue, history, and a favorites list capped at three that rejects overflow deterministically rather than evicting.

    Model answerdesigndequehash-mapconcurrency

More topics