KatInterview

Topic

Data Structure Design interview problems

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

Problems739

53 easy589 medium97 hard

Showing 331–360 of 739 results

  • Design a thread-safe class that caps how many requests each user may make in any trailing time interval, avoiding the burst problem of fixed windows, with sub-linear cost per check.

    Model answerrate-limitersliding-windowdequeconcurrency
  • Match students to rooms by hard size preference in input order, respecting capacity, keeping partially filled rooms, and reporting students who could not be placed.

    Auto-gradedqueuessimulationhash-mapgreedy
  • Design a cached repeat-alert counter that triggers rejection of a work order, then extend it so an alert's severity can change without corrupting counts or past decisions.

    Model answercachingidempotencyconcurrencyversioning
  • Construct an object-oriented expression tree for logical and comparison operations that evaluates safely against context dictionaries with short-circuiting.

    Model answerobject-oriented-designtreecomposite-patternevaluation-engine
  • Simulate an in-memory ledger from text commands, with validated transfers and a leaderboard ranked by outgoing volume with an alphabetical tie-break.

    Auto-gradedhash-mapsimulationsortingstring-parsing
  • Design a string key-value store with transactional writes, fast rollback, and a count of keys holding a given value, with all transaction semantics spelled out.

    Model answerhash-maptransactionsundo-logdesign
  • Simulate a topic-based message broker from a command log, handling token issuance, ordered delivery records, and idempotent unsubscribes.

    Auto-gradeddesignhash-mapsimulationordering
  • Design and implement an in-memory calendar event service with full CRUD operations, validation rules, conflict detection, and unit testing strategy.

    Model answerdesignintervalscrudvalidation
  • Implement a class for weighted sampling that supports O(1) sampling for static inputs and logarithmic updates for dynamic environments.

    Model answerdesign-dsheaps-sortingmath-bits
  • Simulate a task tracker driven by a list of operations, handling creation, reassignment, completion, and multi-key sorted queries while returning one result per operation.

    Auto-gradeddesignhash-mapsortingsimulation
  • Build an in-memory engine that keeps the latest valid top-of-book quote per venue, expires old ones, and reports the most profitable buy-low/sell-high pair across venues.

    Model answerclass-designhash-mapmarket-dataedge-cases
  • Walk a time-ordered event feed and decide which events pass a 10-second per-key cooldown, where only accepted events restart the cooldown.

    Auto-gradedhash-mapsimulationrate-limitingstreams
  • Design a concurrency-safe Account class supporting deposits, withdrawals, atomic transfers, and absorbing another account, while preventing overdrafts, deadlocks, and operations on closed accounts.

    Model answeroopconcurrencylockingdeadlock
  • Design classes and an allocation API for a multi-floor garage that assigns the closest suitable bay to each vehicle, stays correct under concurrent requests, and handles a full garage.

    Model answerobject-oriented-designconcurrencyheaplow-level-design
  • Simulate an ordered account ledger where each payment rail has its own settlement delay, cutoff-shifted window assignment, and per-window cap, and output the combined results.

    Auto-gradedsimulationhash-mapheapdesign
  • Design a React wizard with profile, address and review stages, covering validation, guarded navigation, disabled controls, a submit spinner and server error display, plus scaling and performance trade-offs.

    Model answerreactformsuseReducervalidation
  • Maintain per-node totals in a rooted tree while nodes are collapsed into leaves or have a subtree grafted onto a leaf, answering total queries after each change.

    Auto-gradedtreehash-mapsimulationparent-pointers
  • Simulate a sequence of node toggles, edge edits, and connectivity queries on an undirected graph where only alive nodes count and edges are only added between alive endpoints.

    Auto-gradedunion-findgraphsimulationconnected-components
  • Process a batch of commands on a charging-station registry, with status updates, spherical distance and nearest-online lookups that break ties deterministically.

    Auto-gradeddesignsimulationhaversinesorting
  • Describe the two reference counts in a shared_ptr control block, how weak_ptr uses them, why lock() is needed, and how a weak back-edge fixes a leaking ownership cycle.

    Model answercppsmart-pointersshared_ptrweak_ptr
  • Simulate a fixed-size recency-evicting key-value store from a command log, and separately count connected groups in an undirected graph, returning both results together.

    Auto-gradedlru-cachehash-mapordered-dictunion-find
  • Describe a repeatable process for data-structure designs that are simple to state but long to code, then apply it to a price-time-priority limit order book.

    Model answerdata-structure-designorder-bookinvariantslazy-deletion
  • Design and implement the last stage of a database engine: a catalog of databases, schemas, and tables plus durable row insert, read, update, and delete that survives restarts.

    Model answerstorage-enginepersistencecrash-safetywrite-ahead-log
  • Simulate a command sequence on a referral forest, maintaining subtree revenue totals and answering ranked queries filtered by a strict threshold.

    Auto-gradedhash-maptreesimulationsorting
  • Build a React and TypeScript component that finds a hidden token in the DOM or over HTTP, types it out every 50ms, never replays the animation, cleans up after itself, and has Mocha tests.

    Model answerreacttypescripthooksasync
  • Simulate a forward-only iterator that yields every k-th element, with an idempotent has-next check, and return the results of a scripted sequence of operations.

    Auto-gradediteratorsimulationstate-managementdesign
  • Simulate a stateful ledger driven by operation lists: track per-runner payout sums and compute maximum simultaneous half-open intervals clipped to a query window.

    Auto-gradedsweep-linehash-mapintervalssimulation
  • Simulate a hierarchical key store from a batch of create/get commands, where a key can only be created once its parent key already exists.

    Auto-gradeddesignhash-maptriesimulation
  • Simulate a command interpreter that registers sites, toggles their health, and answers nearest-healthy-site queries by great-circle distance, with strict validation and tie-breaking.

    Auto-gradedsimulationstring-parsinghash-mapvalidation
  • Process a stream of add and query operations over sentences, tracking adjacent-word counts and returning the most frequent follower with lexicographic tie-breaking.

    Auto-gradedhash-mapstringssimulationcounting

More topics